Check sibling questions

Julie has created a dictionary containing names and marks as key value pairs of 6 students. Write a program, with separate user defined functions to perform the following operations: 

  • Push the keys (name of the student) of the dictionary into a stack, where the corresponding value (marks) is greater than 75. 

Pop and display the content of the stack. 

For example: If the sample content of the dictionary is as follows:

R={"OM":76, "JAI":45, "BOB":89, "ALI":65, "ANU":90, "TOM":82} 

The output from the program should be: TOM ANU BOB OM


R={"OM":76, "JAI":45, "BOB":89,

"ALI":65, "ANU":90, "TOM":82}

def PUSH(S,N):


def POP(S):

if S!=[]:

return S.pop()


return None


for k in R:

if R[k]>=75:


while True:

if ST!=[]:

print(POP(ST),end=" ")



983 students joined Teachoo Black. What are you waiting for?

Davneet Singh's photo - Teacher, Engineer, Marketer

Made by

Davneet Singh

Davneet Singh is a graduate from Indian Institute of Technology, Kanpur. He has been teaching from the past 12 years. He provides courses for Maths and Science at Teachoo.