Test Index
CBSE Class 12 Computer Science 2024 Paper Set 4
© examsnet.com
Question : 30 of 35
Marks:
+1,
-0
Consider a list named
Nums which contains random integers.Write the following user defined functions in Python and perform the specified operations on a stack named BigNums.(i) PushBig() : It checks every number from the list Nums and pushes all such numbers which have 5 or more digits into the stack, BigNums.(ii) PopBig() : It pops the numbers from the stack, BigNums and displays them. The function should also display "Stack Empty" when there are no more numbers left in the stack.For example: If the list Nums contains the following data :Nums = [213,10025,167,254923,14,1297653,31498,386,92765]Then on execution of
PushBig(), the stack BigNums should store :[10025, 254923, 1297653, 31498, 92765]And on execution of
PopBig(), the following output should be displayed :9276531498129765325492310025Stack Empty
Go to Question: