diff --git a/Draw-Patten-Using-Loop/pattern.py b/Draw-Patten-Using-Loop/pattern.py new file mode 100644 index 0000000..6e364e8 --- /dev/null +++ b/Draw-Patten-Using-Loop/pattern.py @@ -0,0 +1,7 @@ +N = int(input('enter number')) +number = N+1 +for _ in range(N): + print() + number=number-1 + for i in reversed(range(1,N+1)): + print(str(i)*number,end="") diff --git a/HacktoberfestHackDay2018 b/HacktoberfestHackDay2018 new file mode 160000 index 0000000..b8d27d2 --- /dev/null +++ b/HacktoberfestHackDay2018 @@ -0,0 +1 @@ +Subproject commit b8d27d24a48758d9678354b377839b37908268e7 diff --git a/List-Operation/ChiragPatil/stackUsingList.py b/List-Operation/ChiragPatil/stackUsingList.py new file mode 100644 index 0000000..8194e58 --- /dev/null +++ b/List-Operation/ChiragPatil/stackUsingList.py @@ -0,0 +1,52 @@ +class st: + def __init__(self): + self.stack = [] + + def push(self,item): + self.stack.insert(len(self.stack),item) + + def pop(self): + if len(self.stack)==0: + print('Stack is empty') + else: + print(self.stack[-1]) + self.stack.remove(self.stack[-1]) + + + def peek(self): + if len(self.stack)!=0: + print(self.stack[-1]) + + def isEmpty(self): + if len(self.stack)!=0: + return False + else: + return True + + def display(self): + print(self.stack) + +s = st() + +while True: + print('\npush ') + + print('pop') + print('quit') + print('display') + print('peek') + do = input('What would you like to do? ').split() + + operation = do[0].strip().lower() + if operation == 'push': + s.push(int(do[1])) + elif operation == 'pop': + s.pop() + elif operation == 'display': + s.display() + elif operation == 'isEmpty': + s.isEmpty() + elif operation == 'peek': + s.peek() + elif operation == 'quit': + break