Write a Python program to accept 10 integers from the user. If the entered number is a three-digit even integer, push it onto a stack. After all inputs are taken, pop all the three-digit even integers from the stack and display them. For example, if the user enters 12, 31, 320, 457, 6, 92, 924, 220, 1, 218, then the stack should contain:
320, 924, 220, 218
and the output of the program should be:
218 220 924 320
stack = []
for i in range(10):
n = int(input('Enter an integer: '))
if 100 <= n <= 999 and n % 2 == 0:
stack.append(n)
while len(stack) > 0:
print(stack.pop(), end=' ') A stack named FruitStack, implemented using list, contains records of some fruits. Each record is represented as a dictionary with keys 'Name', 'Origin', 'Price', and 'Expiry'. A sample record is given here:
{'Name':'Apple','Origin':'France','Price':120,'Expiry':'12-08-2025'}Write the following user-defined functions in Python to perform the specified operations on FruitStack:
(i) push_fruit(FruitStack, Fruit): This function takes the stack FruitStack and a new record Fruit as arguments and pushes the record stored in Fruit onto FruitStack if the Price is less than 100.
(ii) pop_fruit(FruitStack): This function pops the topmost record from the stack and returns it. If the stack is already empty, the function should display “UNDERFLOW”.
(iii) display(FruitStack): This function displays all the elements of the stack starting from the topmost element. If the stack is empty, the function should display 'EMPTY STACK'.
Sanjeevani is a big group of educational institutions with its head office in Hyderabad. It is planning to set up a new University in Amritsar. The Amritsar University Campus will have four blocks/buildings – ADMIN, ACADEMIC, HOSTEL, SPORTS. You, as a network expert, need to suggest the best network-related solutions for them to resolve the issues/problems mentioned in points (i) to (v), keeping in mind the distances between various blocks / buildings and other given parameters.
Block to Block distances (in Mtrs.):
| FROM | TO | DISTANCE |
|---|---|---|
| ADMIN | ACADEMIC | 60 M |
| ADMIN | HOSTEL | 160 M |
| ADMIN | SPORTS | 80 M |
| ACADEMIC | HOSTEL | 40 M |
| ACADEMIC | SPORTS | 120 M |
| HOSTEL | SPORTS | 150 M |
Distance of Hyderabad Head Office from Amritsar University Campus = 2000 km.
Number of computers in each block: ADMIN – 25, ACADEMIC – 600, HOSTEL – 120, SPORTS – 50.
NextStep is an organization which has a pool of resource persons to conduct training workshops on various topics related to ICT. The data of all its Resource Persons is stored in a binary file RESOURCES.DAT using the following record structure (each record is a tuple):
(R_ID, R_Name, R_Expertise, Charges)
where R_ID – Resource Person's ID (An integer); R_Name – Resource Person's Name (A string); R_Expertise – Area of expertise of the Resource Person; Charges – Charges (in rupees) per hour to conduct a workshop.
For example, a record in the file is:
(12, 'P. Velusami','Machine Learning',5000)In this context, write the following user defined functions in Python:
Assume that you are the Manager of the Loans department of a Finance House. To keep track of the loans you have created two tables: CUSTOMERS and LOANS. The sample data in these tables is given below:
Table: CUSTOMERS
| C_ID | C_Name | Phone |
|---|---|---|
| 00001 | Raj Malhotra | 1234567890 |
| 00003 | David Xavier | 3456789012 |
| 00004 | Damini Iyer | 3156789012 |
| 00008 | Abdul | 2345678901 |
Table: LOANS
| SNo | C_ID | L_Amt | L_Date | Terms | RoI |
|---|---|---|---|---|---|
| 1 | 00003 | 200000 | 2025-12-06 | 60 | 7.80 |
| 2 | 00008 | 2500000 | 2023-08-09 | 60 | 9.00 |
| 3 | 00001 | 500000 | 2025-08-13 | 48 | 6.00 |
| 4 | 00003 | 300000 | 2026-12-07 | 36 | 8.00 |
| 5 | 00004 | 600000 | 2026-12-07 | 60 | 6.00 |
Note: The tables may contain more records than shown here.
The management of the Finance House needs certain reports from you. Write the queries to extract the following data to create the reports:
Abhishek has created a table, named STOCK, with a set of records to maintain the data of packaged milk in his shop. After creating the table, he entered the data and the table looked as follows:
| Code | Type | Volume | Qty | Price |
|---|---|---|---|---|
| AF0.5 | F | 0.5 | 300 | 38.00 |
| MF0.5 | F | 0.5 | 250 | 36.50 |
| MT1.0 | T | 1.0 | 150 | 64.00 |
| AT1.0 | T | 1.0 | 100 | 66.00 |
| PD1.0 | D | 1.0 | 50 | 52.00 |
| PT0.5 | T | 0.5 | 78 | 30.00 |
“The Reserve Bank of India (RBI) has decided to increase the loan amount to 90% of the security value, from the prior rate of 70%.’’
In the light of the above statement, identify the type of monetary measure exercised by the Reserve Bank of India (RBI) and its likely impacts on the Aggregate Demand of an economy.
The books of Ashish and Vishesh showed that their capital employed on 31st March, 2025 was Rs 4,00,000. If the normal profits are Rs 60,000 and super profits are Rs 40,000, the normal rate of return is: