We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2
input:
Last 20 minutes revision for if the original content of file is:
India is my country Practical’s I love Python OUTPUT Total Vowels :9 Set- C : Write a program to find whether an Total Consonants : 18 in putted number is perfect or not. Total Capital letters :3 Total Small letters in file : 27 Set- D :Program to create binary file to store Rollno and Name, Search any Rollno and display name if Rollno found otherwise “Rollno not found” import pickle student=[] f=open('student.dat','wb') ans='y' while ans.lower()=='y': roll = int(input("Enter Roll Number :")) name = input("Enter Name :") student.append([roll,name]) ans=input("Add More ?(Y)") pickle.dump(student,f) f.close() ============================Set- f=open('student.dat','rb') B :Write a python Program to read the student=[] while True: content of file and display the total try: numberof Consonants, uppercase, student = pickle. load(f) vowels and lowercase characters.‟ except EOFError: break f = open("file1.txt") ans='y' v=c=u=l=0 while ans.lower()=='y': data = f.read() found=False for ch in data: r = int(input("Enter Roll number to search :")) if ch.isalpha(): for s in student: if ch.lower() in “aeiou”: if s[0]==r: v+=1 print("## Name is :",s[1], " ##") else: found=True c+=1 break if ch.isupper(): if f o u n d = = F a l s e : u+=1 print("##Sorry! Roll number not elif ch.islower(): found")ans=input("Search more ?(Y) :") l+=1 f.close() print("Total Vowels :", v) OUTPUT print("Total Consonants :",c) Enter Roll Number :1 print("Total Capital letters:",u) Enter Name :Amit print("Total Small letters :",l) Add More ?(Y)y f.close() Enter Roll Number :2 Enter Name :Jasbir Add More ?(Y)n Enter Roll number to search :2 3.Display ## Name is : Jasbir ## 4.Exit Search more ?(Y) :y Enter your choice: 3 Enter Roll number to search :4 25 ##Sorry! Roll number not found 1.PUSH Search more ?(Y) :n 2.POP Set A : write a menu driven program to 3.Display implement stack operation using a list. 4.Exit st=[] Enter your choice: 4 while(1): print ("1. PUSH") print ("2. POP ") print ("3. Display") print("4.Exit") ===================================== choice=int(input("Enter your choice: ")) ====SQL : if (choice==1): FOR SET- B,C a=int(input("Enter any number :")) (i) SELECT * FROM EMPLOYEE ORDER BY st.append(a) DOJ DESC ; elif (choice==2): (ii) SELECT NAME,DESIG FROM EMPLOYEE if (st==[]): WHERE SGRADE IN ('S02','S03'); print ("Stack Empty" ) (iii) SELECT SGRADE, COUNT(*) FROM else: EMPLOYEE GROUP BY SGRADE ; print ("Deleted element is : ",st.pop()) (Iv) SELECT NAME,DESIG,SALARY,HRA FROM elif (choice==3): EMPLOYEE E,SALGRADE S for i in range(len(st)-1,-1,-1): WHERE E.SGRADE=S.SGRADE AND SALARY<=50000 print (st[i]) elif (choice ==4): break else: print("Invalid Input") FOR SET- A,D (I )Select * from TRANSACT where TYPE=’Withdraw’; output: (II)Select ANO, AMOUNT from TRANSACT where DOT like ‘2017-05-%’; (iii) Select MIN(DOT) from TRANSACT where ANO=102 1.PUSH (iv) Select T.ANO,ANAME,AMOUNT from ACCOUNT A, 2.POP TRANSACT T where A.ANO = T.ANO and AMOUNT<=3000 3.Display 4.Exit Enter your choice: 1 Enter any number:25 1.PUSH 2.POP Note : Find the output yourself 3.Display 4.Exit Enter your choice: 1 ** “All the Best from Department of CS and IP Staff Enter any number:10 ”** 1.PUSH 2.POP 3.Display 4.Exit Enter your choice: 2 Deleted elements is :10 1.PUSH 2.POP