You are on page 1of 2

1.

customer=[["Gurdas", "99999999999","Goa"],["Julee",
"8888888888","Mumbai"],["Murugan","77777777777","Cochin"],
["Ashmit", "1010101010","Goa"]
]
status=[]
def Push_element():
for i in customer:
if i[2]=='Goa':
status.append([i[0],i[1]])
def Pop_element():
while len(status):
print(status.pop())
else:
print("Stack is Empty")

Push_element()
Pop_element()

2.

status=[]
Sitem={"Pen":106,"Pencil":59,"Notebook":80,"Eraser":25}

def Push(Sitem):
for i in Sitem:
if Sitem[i]>75:
status.append(i)
print(status)
print("The count of stack is ",len(status))
Push(Sitem)

3.

customer=[["Siddarth","Delux"],["Rahul","Standard"],["Jerry","Del
ux"]]
hotel=[]
def Push_cust():
for i in customer:
if i[1]== 'Delux':
hotel.append(i[0])
def Pop_cust():
while len(hotel):
print(hotel.pop())
else:
print("Underflow")
Push_cust()
Pop_cust()
4.

Vehicle={"Santro":"Hunadi","Nexon":"TATA","Safari":"Tat
a"}
stack=[]
def Push():
for i in Vehicle:
if Vehicle[i].lower()== 'tata':
stack.append(i)
print(stack)

Push()

5.

l=[10,13,15,20,25,68,98,75,110]
stack=[]
def Push():
for i in l:
if i%10==0:
stack.append(i)
print(stack)
def Pop():
while len(stack):
print(stack.pop())
else:
print("Underflow")
Push()
Pop()

6.

l=["Try","Where","That","Why"]
vowel=['A','E','I','O','U','a','e','i','o','u']
stack=[]
def Push():
for i in l:
flag=0
for j in i:
if j in vowel:
flag=1
break
if flag==0:
stack.append(i)
print(stack)
Push()

You might also like