0% found this document useful (0 votes)
35 views5 pages

Python Set 2 - Merged

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
35 views5 pages

Python Set 2 - Merged

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
ae ere eS: eesti Saeeesc cs ck no. of elenent: Bytes ad cece ers coi Briar ee or ey Preston Postar ren Coe esecs eae ees aoe display all elements cr Enter your element Brcere eo Soot ae aoe Preston cae p element: Sees Sees Presryey tase ee era ie Pecos este SC a aera Pore eevee orn renee eer Vestas Cen e reS cs Sree een es ccis Cree Ss ens ee Pees cen ss eae Crees 3 eS ee Creu cry ee Pest rane cus re aoe cae aes Enter display all Eran ete! ae push element. Postar SS Cas eso Peony as erioe ho: Seta 1 to push element. eee ors Peewee esas oe esc SOR estrts Cote element : 10 osc a pees e Pocus Cece es coc so display all elements. the town Weallivein Lucy in the File Edit’ View We all live in a yellow submarine Yellow submarine, yellow submarine We all live in a yellow submarine Yellow submarine, yellow submarine And our friends are all aboard Many more of them live next door ‘And the band begins to play We all live in a yellow submarine Yellow submarine, yellow submarine We all live in a yellow submarine Paul atriedis ishiraj Palchaudhuri «inthe Lucy inthe s File Edit View Paul atriedis Ishiraj Palchaudhuri def cum_no(n): s=0 while n> 0: renS10 neni/ ie return 5 x = int(input ("Enter a number : *)) sun_val = sum_no(x) print("The sum of the digits of the number ", x, Enter a number se The sum of the digits of the number 14 is import random choice ~ "y' while choice. lower() umber = random.randint (1,6) print (number) choice = input ("Do you want to play more? (V/N)") 3S Do you want to play more? (Y/N) Y 3 De you want to play more? (Y/N) N fpr «gna 6dr ey et", °°) sail set: ste fn ceain|) vor rel for {insets est "Fs ew") rin) fence) Diapnee ty #1 + ceeds aay #0 418 ¢tt #as¢2 pAc§ ly # e&te# comnts # edict iene 9st gion ran # 5 # saps #8, 7 Be yt on Pah prone fof etn 7 spn +t? Eat fore epee # serpy #1 # he on # Gener teeny ett tee open = open("C: \\Users\91958\ \GneDrive\\Desktop\\COMPUTER\ \New.txt", "r") stra v= ucese = lease - 0 vowels = "aeiquAFTOU" str = fopen.read() for 4 in stra LE i in vowels: viet if L-isupper(): ucese += 2 elif i. ieloner() Icase += 1 print("the no of vowels in the text = ~, v) print ("The no of uppercase characters in the text = print ("The na of lowercase characters in the text open. close() ", vcose) » lease) The no of vowels in the text = 127 ‘The no of uppercaze characters in the text The no of lovercase characters in the text = 354 inport pickle Fopen = open(*Std_bin.dat", "wb") n = int(input ("How many Students?")) for 4 in range(n): LF; name = input ("Enter the name ) Lsppend(nane) roll = int(input("Enter the roll :*)) 1L.gppend(roi1) pickle. dunp(1, fopen) Fopen.cloze()) Fopen = open("Std bin. strl =" " reLl_no = int(input(“Enter the roll no to search”) ty while True: M1 = pickle. lead (Fopen) 4€ 11[2] == roll_no: stra = 12/0] breek if stra ws print ("Nane of the students with ", roll_no, " else: print ("student with“, roll_no, “As not present in the file") ‘except E0FError: fopen.cloze() n) ue) Hou many Students? 3 Enter the name : anuesha Enter the roll : 5 Enter the name : Asdichres Enter the roll : 1 Enter the none : adité Enter the roll : 2 Enter the roll no to search 7 Student with 7 is not present in the file open = open(*C:\\Users\\91958\\OneDrive\\Desktop \\COPUTER! \File txt") "F") Fd ~ open("C: \\Users\\02953\ \OneDrive\ \Desktop\\COMPUTER| \Newtext -txt","2") ste = while stra: str ~ fopan.readline() GF stri.count('n") ~~ 1 Fd.wrdte(2tea) Fopen.cloze() #é.cloze() Amport csv DFile = open(*test.csv", “w", newline = ‘*) uurster ~ cev.urster(CFile) = dntCinput ("How many records you want to insert 2 ")) for 4 in range(n): 1-0 roll = AntCinput ("Enter the roll no of the student:")) 1 .append(roll) pane ~ input("Enter the sane of the Student +“) ‘append(nane) uriter.nciterou (2) o#ile.close() Déile = open(*test.cav", "r*, newline reader = csy.reader(Ofile) roll_no ~ ingut("Enter the roll no of the student to saarch for rec an ureader: 4 rec{@] == rolln print (‘Mane of the Student of Roll Na Déite.close() » rell_no, "is How many records you want to insert i: 5 enter Enter Enter Enter enter Enter Enter enter Enter Enter enter Name of the Student of Rell No S de Anwesh the the the the the the the the the the the rel fell fell pall rail rel of of of of of of the etudent: 2 the Student : Aditi Roy of the student: 4 the Student + Aadichrees of the student: 6 the Student : of the student: 3 ‘the student : Aryan of the student: the Student : Utkarsh of the student to search Anneshe °

You might also like