SET---1
1.)Write a Python Program to read a text file line by line and display
those words of each line which started with any vowel character.
with open("[Link]") as f:
for line in f:
print([w for w in [Link]() if
w[0].lower() in "aeiou"])
OR
1.) create a python program to create a stack of student’s marks, which
retrieve the information from a dictionary. Stud = {‘Amit’: 40,
‘Rajeev’: 59’, ‘Nilam’ : 75, ‘Sanyam’: 49}
Write function PUSH(Student) to add marks of those students
which have marks more than 50 from a dictionary Student. and
Write function POP to remove the marks from stack and display the
same.
Stud = {'Amit':40, 'Rajeev':59, 'Nilam':75,
'Sanyam':49}
stack = []
def PUSH(Student):
for m in [Link]():
if m > 50:
[Link](m)
def POP():
if stack:
print([Link]())
PUSH(Stud)
POP()
SET---1
2.) Consider the following DEPT and WORKER tables. Write SQL
queries for (i) to (iv):
To display Wno,
Name, Gender from the table WORKER in descending order of WNO.
a. To display the Name of all the FEMALE workers from the table
WORKER.
b. To display the Wno and Name of those workers from the table
WORKER who are
born between ‘1987-01-01’ and ‘1991-12-01’.
To count and display MALE workers who have joined after ‘1986-01-
01’
(i)
SELECT Wno, Name, Gender FROM WORKER ORDER BY
Wno DESC;
(a)
SELECT Name FROM WORKER WHERE Gender =
'FEMALE';
(b)
SELECT Wno, Name FROM WORKER
SET---1
WHERE DOB BETWEEN '1987-01-01' AND '1991-12-
01';
(c)
SELECT COUNT(*) FROM WORKER
WHERE Gender = 'MALE' AND DOJ > '1986-01-01';