Professional Documents
Culture Documents
Q-1 a)Write a menu driven python program to create a stack of a student's record
which contains [admo, marks ]. (8) i)Write function PUSH to add record in to the
stack and
ii)Write a function DISPLAY to display those students whose marks are greater
than 70.
SOURCE CODE:
students=[]
def PUSH():
admo=int(input("Enter the admission number of the student:"))
marks=int(input("Enter the marks of the student:"))
l=[admo,marks]
students.append(l)
def DISPLAY():
for rec in students:
if rec[1]>70:
print(rec)
while True:
print('''
1. Push
2. Display
3. Exit
''')
ch=int(input("Enter your choice:"))
if ch==1:
PUSH()
elifch==2:
DISPLAY()
elifch==3:
break
else:
print("Invalid Choice!")
OUTPUT:
1. B.
b) UPDATE STU SET Fees = 170 WHERE Rollno = 1 AND Fees < 130;
Query OK, 1 row affected (0.05 sec)
Rows matched: 1 Changed: 1 Warnings: 0
output:
mysql> select * from stu;
+--------+--------+--------+------+----------+------------+------+
| Rollno | Name | Gender | Age | Dept | DOA | Fees |
+--------+--------+--------+------+----------+------------+------+
| 1 | Arun | M | 24 | COMPUTER | 1997-01-10 | 170 |
| 2 | Ankit | M | 21 | HISTORY | 1998-03-24 | 200 |
| 3 | Anu | F | 20 | HINDI | 1996-12-12 | 300 |
| 4 | Bala | M | 19 | NULL | 1999-07-01 | 400 |
| 5 | Cheran | M | 18 | HINDI | 1997-09-05 | 250 |
| 6 | Deepa | F | 19 | HISTORY | 1997-06-27 | 300 |
| 7 | Dinesh | M | 22 | COMPUTER | 1997-02-25 | 210 |
| 8 | Usha | F | 23 | NULL | 1997-07-31 | 200 |
+--------+--------+--------+------+----------+------------+------+