You are on page 1of 2

Ques-1.

(i)
f=open("story.txt",'w')
f.write("Hello How are You\n")
f.write("I am fine\n")
f.write("Thankyou\n")
f.close()

fin=open("story.txt","r")
line=' '
while line:
line=fin.readline()
for word in line.split():
print(word+'#',end=' ')
print()
fin.close()

(ii)
def printPattern(line):
for n in range(1, line+1):
print(“#” * n)
line = int(input(“Enter number of line : “))
printPattern(line)

Ques-2.
marks = []
def PUSH(m):
marks.append(m)
def POP( ):
if marks == []:
print(“Empty Stack”)
else:
p = marks.pop()
print(p)
#to invoke push for five times
print(“PUSHING”)
for a in range(5):
num = int(input(“Enter Number : “))
PUSH(num)
#to invoke pop for six times
print(“POPPING”)
for a in range(6):
POP()

Ques-3.
(i)mysql.connector
(ii)mycon = sqltor.connect
(iii)(“SELECT * FROM DRUG WHERE PRICE BETWEEN 50 AND 100” )
(iv)data = cursor.fetchall()

You might also like