Computer Science - Class 12
Solutions to CBSE Sample Paper - Computer Science Class 12

Write a function in Python, Push(SItem) where , SItem is a dictionary containing the details of stationary items– {Sname:price}.

The function should push the names of those items in the stack who have price greater than 75. Also display the count of elements pushed into the stack.

For example:

If the dictionary contains the following data:



The stack should contain



The output should be:

The count of elements in the stack is 2



stack_items=[ ]

def Push (SItem): 

    count= 0

    for i in SItem:

        if SItem[i]>= 75 :


            count=count+ 1

    print( "The count of items in the stack: " ,count)


Learn in your speed, with individual attention - Teachoo Maths 1-on-1 Class

Ask a doubt
Davneet Singh's photo - Co-founder, Teachoo

Made by

Davneet Singh

Davneet Singh has done his B.Tech from Indian Institute of Technology, Kanpur. He has been teaching from the past 13 years. He provides courses for Maths, Science, Social Science, Physics, Chemistry, Computer Science at Teachoo.