Page 23 - PYTHON-12
P. 23
print("No uppercase strings available.")
else:
print("All uppercase strings in the stack:")
for item in reversed(UpperStack): # Display from top to bottom
print(item)
strings = ["information", "message", "Python", "encrypted"]
Push_upper(strings)
Show_all_upper()
print("Popped string:", Pop_upper())
Show_all_upper()
31. Predict the output of the following code. (3)
colors = ('red', 'blue', 'green', 'yellow', 'blue')
x = [color for color in colors if color!= 'blue']
print("Filtered colors list:", x)
y = tuple(x)
print("Tuple after filtering:", y)
OR
Predict the output of the following code.
products = {'P1': 50, 'P2': 30, 'P3': 60, 'P4': 45}
for product in list(products):
if products[product] < 40:
products[product] *= 2
else:
del products[product]
print("Final products dictionary:", products)
Ans. Filtered colors list: ['red', 'green', 'yellow']
Tuple after filtering: ('red', 'green', 'yellow')
OR
Final products dictionary: {'P2': 60}
Section D
32. Consider the given table DONATIONS. (4)
Donor_ID Donor_Name Organization Amount Date_Of_Donation
D1121 Sandeep Bansal Bless Orphanage 35000 2024-10-25
D1122 Mohita Aggarwal Blinds’ Society 65000 2024-08-21
D1123 Shreya Sharma Mid-Day Meal Society 80000 2024-02-10
D1124 Rahul Malhotra Bless Orphanage 45000 2024-07-01
Note: The table contains more records than shown here.
(A) Write the following queries.
(I) To display the total Amount of donations for each organization, excluding organizations with a total
donation Amount less than 40000.
Model Test Paper (Solved) A.9