s=[]
def isEmpty():
return s == []
def pus(i):
s.append(i)
print(s)
return s
def po():
return q.pop()
def size():
return len(s)
def pr():
return s
while True:
print('Press a for push')
print('Press b for pop')
print('press c for the size')
print('Press d for display')
print('Press e for quit')
op = input('What would you like to do')
if op == 'a':
n=int(input("enter a number to push"))
q=pus(n)
elif op == 'b':
if isEmpty():
print('Stack is empty.')
else:
print('Deleted value: ',po())
elif op=='c':
print(size())
elif op=='d':
print(pr())
elif op == 'e':
break
def isEmpty():
return s == []
def pus(i):
s.append(i)
print(s)
return s
def po():
return q.pop()
def size():
return len(s)
def pr():
return s
while True:
print('Press a for push')
print('Press b for pop')
print('press c for the size')
print('Press d for display')
print('Press e for quit')
op = input('What would you like to do')
if op == 'a':
n=int(input("enter a number to push"))
q=pus(n)
elif op == 'b':
if isEmpty():
print('Stack is empty.')
else:
print('Deleted value: ',po())
elif op=='c':
print(size())
elif op=='d':
print(pr())
elif op == 'e':
break
Computer Information - Get the solutions of all the computer software and hardware issues online in just one click by visiting computermobile.info. It is a top website that provides computer information online free of cost. If you are new in Information technology and looking basic to advance information then visit computermobile.info.
ReplyDeleteFor more visit : Computer Mobile Info