0% found this document useful (0 votes)
32 views20 pages

10 To 40 (C S Practicals)

Uploaded by

ayushbaap40
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)
32 views20 pages

10 To 40 (C S Practicals)

Uploaded by

ayushbaap40
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
You are on page 1/ 20
Page No. Oth! Wnt @ etegren b pind fie de_tebeal dupbere for ia is roppe (4, LL) Urint_L) Progen to print Me charachis in Sting Peniow” alge | [gee Listed = * Pyrnon” | tori in sie ft pirat {¢) gta. Aregram to print cv turlys in 2 gian eq. wing br Loge | a yee a |e fia tailed if /29 == Dt peint (7) Olt. Une a Program to lint table of ?npubtecl number N=_int Cingud [" enker number +”) ) fet fo pn pig (411) Ten 7h Teocher’s Signature = | Exp. No. 5160. Date .....------- (gis, Prepare to print fist fo nateal runboy wary while agp. | eed dahil 2 pai (7) =f (P44 Progran to_chek pohndlone or not [vunber nun = fat [input ( Enbr numbers” )) [emp = nur LE hop te hyyoleby shrage H of number, tev = 0 while (nun >0) 2 ape = mun % lo v= rev Jo taig nun = naun{{to V if temo = pei pit (28 “leaker ‘s_ Palvdtome”’) else’ print “ Nunket 7S ofa pabirdrorie” ) Teacher's Signature : eee 5-087)! aan a a aaa ta ln nei tenes ani eid dealin a RANE cane rene OURS ORI Expt. No. ph ene aay ; 7 1 | 942! Pregrare b print Frbonacer Serbs. | n= int (input (“ How Any terns”) it <= 0: pried (“Please enter o Positive Wmber 1”) Q, 6,2 Of priad Ca] | tint (bh 7) | 1 fri in tonge (2, n) | c=ath V eprlibt ete) ab=hse | Date -.. Page No. ... Expt. No. 48.20... 1918 Progran Jo find He feeds of a whale _munkop by wareg white Joop, run= inf lial” Enter a tafolerunber:”)] actor = 4 he. Taedotisation while. fachoy <= hun? | fia ta: oo 1720). Pro gran _clmonsttak Jhon vie of /artinue staomen? Suny # By vig conbut shad we Can on rie ee = £9. Shipp apt. (cfr se_op Condon: dor__awn in range lo)? if 3 <= aun’ <> Rt i Confinue _ptiad (num) Teacher's Signature : o3| Pregran db check jf fhe inputeal nunber_ 1S prine ot not, Aun = 10k Cinput (™ tnbr a under: )) nun <= 12 _ find Coun, is nota peitte runber, 7”) ef num 2-23 nun“ i's a_ptine number,” ) elit nun £9 == Ow pun KB ==0: lmun © snot a prime ruber,” ) else: in tony (5, int (nun 0.5) +L gs £ mn 7% 2 6 or nun 7, (7+2) = =o: priat (nun ,"7s rot a prime number ?*) break ) elses pried Coun, 2 _phime number,” ) Expt. No. 24._ 2b Pepper fo_prind th pattern for__@ munber ‘yd by ie User, Zo 3 ph Pe pe pS 2 Q 2 2 nc om nun= int [input ( Entr the number of pow”)) | for? in _range({,_num+i): fort to! torgelt, £41); print {3 Vv WE Ac ») print 'L) 9 tte A blonk is _usrol fo moe on te he ney) Acne Teacher's Signature : Dats ...1...- +004 Expt. No,.2.2, Page No... eronuiee to Te) wees s hehen lb | % Nested for ofa : He fot__nun _in__teyg an is es came in ba (2, aun): nun f Vi == 02 isaprim = Fala ul} break if _!Septimet priat(nun, “Ls a prime _nunber 7) i to caltuloh fhe _[acbri a_guenhni n= iat Cinpud (* tnker_a numbers ”’)) Factorial = if if n’ Palinalrone a) alse prtat ( str { 47s not a pabrdrone” ) [go] A_propton to Caleulae ava, Paths of Nn Phidnls vasiep—a- when nis %ntereol wseh, = ill input” Enh Be tunbgt “of _stuhakes ”)) maths = ie y fer_i_in renee (1 a marks. appre! 1 real wt” Ender mavks halen + silt th) 4?) | todd. rath = sun (marks) lave = maths = toll matk s/n stl The Aurage ark’ of the sheleds i 7 avg marks} | Teacher's Signature Date - [ expe Noi229.. 20 Page No... Optiations, Such as cd = £41 6520] pital ded © this our Ltt of plonents a) print () print [” “Cheose an option: ”) riot (7 Append on element”) latint ( “9, rser? on element”) [ptiat (3, Append Ist to fe_given dit”) lprint (4, Mod'ty a existing Aenent?) ptial l OSs Dele on cist clerment Lon ib pesilion ”) zie an shi’ elonud n_value”) lorint (7. “Sort He List in" ascondin ae oy rink (2. Sort tHe Let fy descercllyy order”) int (9. Di splay Keo Hist”) =F ( tor Exit”) choice = od Cinpul ( Fater 4 our Choice: 7) ) it. choice = =f element = int Tad Enter the clorend b append: ”')) Ast. g olbrent pint! The Uist has been apperded.”’) peat dsd) Teacher's Signature : expt Nooo Page No....-. elif choice = 9. Alenent = ‘atl y utl Ete Me _ehnent to insert: ”)) dsd fase £( Jadex enent ) pet Tie List fas been ypdlated.”’) jacint ( dst) edit choice = = 3: Astt = [ind (x) for_x in ‘pul ” “tnt the lenent Syptaled by ona” 2 elit (“YT lst, extend (sit) priat-| Te list hos ban appnoled.””) priat list ) edit ple Sei ‘nelex = ab figped Eas te _indee_of Ue ehmut_h be pit 7) neue ebm = int Cinputl gpter fhe new ements” Ast D inde] = pew — elemen btiot (OTe element ad Tndexe”? dex, © Chas en_saok’ nd”) priat List) elif choice a fnolex = int Cina? “enter Hye index of Clorint tb Lo alelete:”)) rd Ast [index] onal phe _ehmend at (redex? Jaleo “has been alee”) _| priat list) Teocher's Signature : i Index = int ( input (“Enter the jrlex wh tnt ty inert: f chit oa ay value= ink Toad ke He tale of the chenent B bachbhe” dst temove Cvolue) print l* The elrment wily the value” value,” fas bem debt” print (dst ) adit choite ==: Led. sort) tak ( “e * p wy ae Me Lit bas boon sorb ceria aiden.”) chit choir Zid son] ranse= eee priai ( The Lit in order,” print (ds4) hil choice == 9 int ("The Ze ioe dst) oht chote= = 10! print ( Tooks for ste IN?) ta eke : ptint (Tvl hoitn”) Teacher's Signature : Expt. No. 5 ci Page No ef 2.1 Weife 2 preptan to check if 2 nurbey _/s present in the List or rot." 7f te oul i Preptal. _ftik the potion of he numbers Prink an (00S apt if Fe_nunber fot pkesent in he Te mun= i408 6 7] Check _ nun = int C input “ Entor_nunber to check ?”’)) i in fappe L de ogea) ity chock nurs priat ee ‘The. number”? check _ num oY is presente position aa iin ho Hest. 7) | else? ptiat C The number”, eck nur, © is_not pres a 2n he. Lishs 9224 Waite a propram create a neshd hple te stote toll number” nome and _narks of thidants Studen#=-() Labile True.* roll = iat Cigout C* orb pall’ number lot 0 7 sky): 7 sf fok{ == O03 tea hame= input (” Enhr name: 7’) marks = float lined ( Enter racks: ® "VI | Stud _tuph = Chol! rane, marks) Student “p= [sh tple, ) print (“Nn Students chtar”? Skdend ) [923] Wik 2 piogran b_iph nunbas salad Laing pd Larichle | a= int (inputl“Enks test niirboy 3) 7 2 tot linn Cf br_Sxcond _trunbor: 7) ) ah= ba print (” Be bre Lapping Fast valves” Bb “ora Send yalue: a) boonll “hfe Suppicg fit wales” a “ad sound value?’ b) Teacher's Signature : ( Expt. No.3 4,35. 93 Aara_ progr fo es ae V ol a circk t= thallinputlnbr dhe teclut al ka tinken\) _| ireunfirence= 9¥ fofgl¥p ——SSSC~—S a = (22/7) * p eo print (" Acca of the circles” ata) iat “Clreuntrence of Me _civele!!? Citumbrence 235 lee a_pnggran de inpul prams than_Me_ueh. store Hat loumbers in “a tuple, “print dhe navinum and mininun ounbers, | um = int Cinput (“take ths numberof nurnbers you want to inpalt| nunf = l) fori _ia_tange( num)! nun 2= latlinput (“ner number” + cipGrt) ts **)) num 1 = (nun? rae _ nun = mar (hunt) mn—num =_minlnunt) ppiat the Entered numbers are?” punt) 7 mar. nun) Bey } pint (“Tha Maxinun_nurber is ( nt (4! The Miniown unter ist”? min_nun) Teacher's Signature : Expt. No..36. (936. Create a olictonary ‘opp’ of add ube baka £ | q Value is fhe Zea ila tutes, ‘a a Rasdies tah the hllacleg operabios 0 z dichormy. ODD = 44: one, 8: Tree’, 5: fi’ F: nnG: ‘vine’ | print " Te keys of the Dictionary :” ODD. dagsl I) peiat O print ( 5 Fhe _valyos of Me Dielonary:\n”, ODD. Values()) tot () pilin The Llens of Dichonary t\n” ODD. Hens (1) - ) wnt The. Legh of Dichonare: _Len (oop) priat L) punt (“Ts Z preset?” 7 oD) focint () pint ER 2 prank?” 9 in ond) rint) pal Value for Ley 3:7, ppotat) pitt Delete tye_iten cotrespandling ve hey 9:7) pei) et a LPP dichonang”, BDD ) Teacher's Signature : ExptiNovwneec a FP ee a, ct ee Page Nos nso 103 litit a progam rr enkr name of employees 0 i Salaries Ge fopud ond store em in adh had cmp..data = £4 w= tat Cioput (" Enter the nurber_of- coploy ees: #y) for_{ in _tange (N }: name = Mout Enfor He tone of spe iN) salary = Float input” Enters none + “§ Salary ' cmp clata Vname] = Salaty print C\n Employer Debik??) ptink (44 Employee Mame \f Employee Salary +) fy name, Salary in _pmp oleta o i dems): print (nave geet? Caan 8tr (salary M) ape to count the _nynbor_of hime a character pews jn 2 (pian. Shing Str f= input (“ Ente a shing Z| ‘Count = for chap in sir ds it char da aa count CoharT + = els ‘taal Cobar I = ie print (" Por charachrr treguenty in LY" fe: \nfh” Og fotmak (str t, count) (929) White 2 progrem _conver? 2 nurbe —enbrd Ay sor into ik oires poraling nynber jn swords. J pure taople= £03 Zev, J: bree? 2° Faso! 2 Tiree! Ys Four! 5S: Faw 8: Sie) 75000 epee eee a Mi g can ‘ine’ 4 D num = inf (inal (% Entra number: any Lords = br_ digits in Stelnum)? hobs + = nun _ words] Indl 1] ee print ( Nunbet io words: *? words. strpl! ) Teacher's Signature : W0l Write a Ly hon _prepran t_creake a dictionary te ahi tect = inpud [” inde a cttipg 2”) Z |_|defier. counts = {+} Por char in jer Char = char. Aower () ff char. Ss abchal): it char in Lett Counk: detter — counts [char] += 1 else’ Letter — counts | char = £ prin L( Le Her counts)

You might also like