For Example :
If the dictionary contains the following data :
Vehicle= {βSantroβ : βHyundaiβ, βNexonβ : βTATAβ, βSafariβ : βTataβ}
The stack should contain
Safari
Nexon
stack=[]
def Push(Vehicle) :
for v_name in Vehicle :
if Vehicle[v_name].upper()=="TATA" :
stack.append(v_name)
OR
stack=[]
def Push(Vehicle) :
for v_name in Vehicle :
if Vehicle[v_name] in ("TATA", "TaTa","tata","Tata"):
stack.append(v_name)
For example : If the lists with customer details are as follows : [βSiddarthβ, βDeluxeβ] [βRahulβ, βStandardβ] [βJerryβ, βDeluxeβ] The stack should contain Jerry Siddarth The output will be : Jerry Siddarth Underflow
Hotel=[]
Customer=[["Siddarth","Delux"],["Rahul","Standard"],["Jerry","Delux"]]
def Push_Cust():
for rec in Customer:
if rec[1]=="Delux":
Hotel.append(rec[0])
def Pop_Cust():
while len(Hotel)>0:
print(Hotel.pop())
else:
print("Underflow")