Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
32 views
16 pages
STD Xi - (11-20) Practical Programs
Code python basic program
Uploaded by
sabarikishore.02
AI-enhanced title
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
Download
Save
Save STD XI-(11-20) PRACTICAL PROGRAMS For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
0 ratings
0% found this document useful (0 votes)
32 views
16 pages
STD Xi - (11-20) Practical Programs
Code python basic program
Uploaded by
sabarikishore.02
AI-enhanced title
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
Carousel Previous
Carousel Next
Download
Save
Save STD XI-(11-20) PRACTICAL PROGRAMS For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
Download
Save STD XI-(11-20) PRACTICAL PROGRAMS For Later
You are on page 1
/ 16
Search
Fullscreen
[& Os ight lr ow 1py-Cses/een/Downlods sight aon 1p (65) Fle Bit Format Run Opins Window Hep program to shift the zeros in a list to right and find the second largest and second lowest value from the list. $ Shifting zeros to the right ‘Leveeval (input ("Enter List:")) Length=len (1st) end = Length-1) Print ("Original list:",1st) id while (iceend) ele-lst[i] af ele=0: for J in range(i,end): Ast (j]*1st(j+1) else: Ast (end]=0 end-=] if Lst[i) !=0: itl print ("Zexo shifted:", 1st) Second Largest: value Ast = eval input ("Enter List:")) Jength = Len (Ist) biggest = secondbiggest = Lst{0] for 2 in range(L, Length): if Ast[i] > biggest: secondbiggest = biggest biggest = Ist [i] elif lst [i] > secondbiggest: secondbiggest = 1st [i] Print ("Largest value of the list:", biggest) print ("Second largest value of the list:", secondbiggest)[UB 0's right 2lar 2tow 1.py - C:/Users/Leena/Downloads/0's right 2lar 2low 1.py (3.6.5) File Edit Format Run Options Window Help Second lowest value st = eval (input ("Enter lis length = len(ast) lowest = secondlowest = 1st[0O} for 4 in renge(, lengen): S£ lst{a] < lowest: Becondiowest = lowest lowest = 1lst[i]} elif lst{a] < secondiowest: secondlowest = 1lst[i] print ("Lowest value of the 1ist:”, lowest) prant ("Second lowest value of the list:", secondiowest)| md [i Python 3.65 Shell File Edit Shell Debug Options Window Help Python 3.6.5 (v3.6.5:£59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD64)] on win32 Type "copyright", "credits" or "license()" for more information. >» RESTART: C:/Users/Leena/Downloads/0's right 2lar 2low 1.py ======== Enter list: (0,5,2,6,0)1,4] Original list: (0, 5, 8 6 0, 1, 4] Zero shifted: [5, 8 6 1, 4, 9, 0) Enver List: (4, 6/1,0,7,9,3] Largest value of the list: 9 Second largest value of the Li: Enter list: [5,3,9,1,8,0,4] Lowest value of the list: 0 Second lowest value of the list: 1 »|[& Swapping and Messagepy-CA\Users\Leena\Downloads\Swapping and Message py (3.65) File Git Format Run Options Window Help #progran to svap elements and display the appropriate ne: je entered by the user fovap elenents in even and odd places val = eval (input ("Enter a 1ist:")) print ("Original List is:*, val) 3 len(val) ifs 82 iO: ses-1 for i in range(0, 3, 2): print(i, #1) val{i] = vel[i#2], val{i] print ("List after svapping:", val) $Search for an elenent entered by the user and display the appropriate message if the elenent is found or not found, Hlowerlist = ['rose', ‘lotus’, ‘sunflover', ‘marigeld', ‘jasnine'] flowerNane = input ("Enter a flover nane:") ‘if flovetName.lower() in floverlist: print (Ms is found in the List" ¥(floverNane)) elset print ("ts is not found in the list” §(flowerName))| [& Python 3.6.5 Shell File Edit Shell Debug Options Window Help Python 3.6.5 (v3.6.5:£59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMDé4)] on win32 Type "copyright", "credits" or "license()" for more information. >>> RESTART: C:\Users\Leena\Downloads\Swapping and Message.py Enter a list:[4,8,2,1,6,$] Original list is: (4, 8 2, 1, 6, $] oa ze 45 List after swapping: [(8, 4), 8 (1, 2), 1, (% 6), 9] Enter a flower name:sunflower sunflower is found in the list >>»(2 fortoop 3:py - CAUsers\Leena\Downloads\forloop 3.py (36.5) File Edit Format Run Options Window Help: fesse to create using for loop #List containing integers 0 te 48 ast= (1 Peer gt) Ast = 1st + [iJ] print (Ise) #List containing the square of numbers from 1 to 50 ast=(1] Ge Ath Ree oij dec ase + Eatt2 | print (st) Hide [a,bb, coc, dddd, eeeee, £8282, ........ escueeusUeTeseuaNEESEEuEN]; #enat ends with 2¢ copies Of the letter z ast=(1) for 4 in range(1,27): lst = let + ( chr(96e) #41 print (se) Drs - 4X Fle Edt Spl Debug Opens Widow Help ‘ython 4.6.5 (vd GSutSGe0Sdbd, Mar 28 2016, 17:00:18) HSC v0 €4 it (DIE) | on win? ‘Type "copyright", “credica® or *License()* foc acre informatica, b» ssseesemmsnes$FSTHH7; (ier LenaDoeloadsforlop gy 10, 1, 2 8 4 $6, 7, 8, 9 10, LY, 12, 18, 14, 25, 16, 27, 18, 18, 20, 21, 22, 28, 24, 25, 26, 27, 28, 29, 90, 31, $2, 33, M4, 85, 96, 91, 38, 98, M0, 41, 42, 93, M4, 45, 46, 47, 48, 48) 10, 2, 4, % 16, 2S, 96, 45, G4, BL, 100, 121, 1H, 165, 196, 225, 256, 289, 124, 361, 400, 441, 404, $28, $76, 625, G76, 725, TH, O41, $00, 961, 1024, 1088, 1186, 12 25, 1246, 1369, 1444, 1521, 600, 16, 2764, L688, 1836, 2025, 2116, 2208, 2904, 2401, 2600] Tia’, "Bo', "cec!, "didd', "eeeee!, “EEEEEE', “gpnogyg', "nabbhthh', "iiidiiiii", 'jj333i4j', "Keene, "LLIILU001', ‘mammommmmem', ‘monnazeannann'; ‘2000 ‘ooooocceono', "pEREERRDMECEENC', ‘GuRCaaaMIyeauRAN', 'zzzrrarerzzrrcrrex', 'ssssssssassassssass', ‘httececettttceteett', "wuuwaazummuuuaaaearan', “TrMRYYTOVreTYYYY ‘Tovey! ‘wvwennwwaerennanawe', "OCRARREAENAAAA , "YYVYTHYYVYVYVYYYVVNYYYYS» 'zez0azzauueazazezzzezz122'| »|Ud 3 marks of m students py - C\Users\Administrator AppData\Local\Programs\PythonPython37-32\3 marks of n students py (7.3) File_Est_Formst_Run Options Window Help stu={} n=int (input ("Enter number of students:")) for i in range(n): name=input ("Enter student name:") nt (input ("Enter mark 1:")) nt (input ("Enter mark 2:")) m3=int (input ("Enter mark 3:")) tot=m1+m2+m3 avg=tot/3 print ("total marks =",tot) print ("average =",avg) stu[name]=(tot,avg) print (stu) a=list (stu.keys()) b=list (stu. values ()) ax (b) i=b.index(c) print ("The topper is",a[i],"with the average of",c)Gh yemaz39ur Fie fe Se Sty Gis dw Hep Python 3.7.3 (v3.7.3:efdecéed12, Mar 25 2019, 21:26:53) [MSC v.1916 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license()" for more information. >» RESTART: C:\Users\Adninistrator\appData\Local\Prograns\Python\Python37-32\3 marks of n students.py Enter number of students:3 Enter student nane:Diya Boter mark 1:90 Enter mark 2:98 Enter mark 3:98 total marks = 286 average = 95.33333333333333 Enter student name:John Eater mark 1:87 Banter mark 2:78 Boter mark 3:86 total marks = 251 average = 83. 6666666666667 Enter student name:Saina Enter mark 1:68 Eater mark 2:66 Eater mark 3:71 total marks = 205 average = 68.33333333333333 {"Diya': (286, 95.33333333333333), 'John': (251, 83.66666666666667), ‘Saima': (205, 68.33333333333333) } ‘The topper is Diya with the average of (286, 95.33393333333333) »[B thveedigit 5 py - C:/Users/Leena/Downloads/threedigit Spy (36.5) File Edit Format Run Options Window Help #program to read a list containing 3 digit integers only and sort the elements of the list #based on the one’s digit of all elements. Ast = eval(input ("Enter a three digit numbers list = ")) length = len(1st) for i in range(1,length): temp = 1st [i]%10 t = lst{i] geal while j>=0 and temp<(1st(j]*10): ist{j+1] = 1st{3] 29-2 Ast[j+l] =t print (1st)| [a Python 36.5 Shell File Edit Shell Debug Options Window Help Python 3.6.5 (v3.6.5:£59¢0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD64)] on win32 ‘Type "copyright", "credits" or "license()" for more information. >>> RESTART: C:/Users/Leena/Downloads/threedigit 5.py Enter a three digit numbers list = (333,267,809, 145, 641] [64l, 333, 145, 267, 809] >» |[i player 6ipy - C./Users/Leena/Downloads/player Gpy (3.6.5) File Exit Format Run Options Window Help program that sorts a list of tuple-elements in descending order of Points. | Ast = [(103 , ‘John’ , 3001), (104 ,"Diya',2819), (101, "Bhuvan' , 3451) , (105, for i in range( len( Ist) - 1): for j in range( len ( lst) - 1): if lst (4) (2)
RESTART: C:/Users/Leena/Downloads/player €.py i "Bhuvan', 3451), (103, 'John', 3001), (108, "Saima’, 2971), (104, "Diya', 2819) >»>(& OTP 7,py - C:\Users\Leena\Downloads\OTP 7.py (3.6.5) File Edit Format Run Options Window Help #program to generate Alpha-numeric OTP with n number of digits. import random import string # get random password of length 4 with letters and digits characters = string.ascii_letters + string.digits password = ''.join(random.choice(characters) for i in range(4)) print ("OTP is:", password)| (Python 365 Shel File Edt Shell Debug Options Window Hep Python 3.6.5 (v9.6.5:£59¢0832b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMDE4)] on win32 Type "copyright", "credits" or "License()" for more information. »> RESTART: C:\Users\Leena\Downloads\OTP 7.py OTP is: 0GéW »|[@ team®py-C\Users\Leena\Dounloadsteampy (265) File Edt Format Run Optins Window Hep foreate a dictionary with keys as the team name and value as the corresponding wins and loses of the tea, dic =} Ascwin = (] Ascres = [] while True : ‘ame = input ("Enter the name of team (enter q for quit)=") if name == "Q" or name = "q" : break else: win = int (input ("Enter the no.of win match =*)) loss = int (input ("Enter the no.of loss match =*)) dic [ name] = [ win, loss } Ascwin + [ win ] ifwin> 0: Astrec + [ name ] print ("created dictionary") print (dic) ynam = input ("Enter the nan of team to calculate win percentage =") print ("inning percentage =",dic [ nam ]{0) *100 / (dic (nam }[0] + dic{nam ]{1] }) (print ("wining list of all team = ",Istwin) print ("ceam who has winning records are ",Jstrec)[é Python 3.65 Shell File Edt Shel Debug Options Window Help Python 3.6.5 (v3.6.5:£59¢0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD64)] on win32 Type "copyright", “credits” or "license()" for more information. >>> RESTART: C:\Users\Leena\Downloads\tean8.py Enter the name of team (enter q for quit)=csk Enter the no.of win match =4 Enter the no.of loss match =1 Enter the name of team (enter q for quit)=mi Enter the no.of win match =1 Enter the no.of loss match =4 Enter the name of team (enter q for quit)=rcb Enter the no.of win match =3 Enter the no.of loss match =2 Enter the name of team (enter q for quit)=Kkr Enter the no.of win match =2 Enter the no.of loss match =3 Enter the name of team (enter q for quit)=q created dictionary {'osk': (4, 1], ‘mits (1, 4], "cb": [3, 2], "ker": (2, 3]) Enter the name of team to calculate win percentage =csk Winning percentage = 80.0 wining list of all team= [4, 1, 3, 2] eal who has winning records are ['csk', 'mi', 'rcb', 'kkr"] >>>[& month py User Lees\Downlads\monthpy (65) File fit Feat Run Options Window Help #Create a dictionary whose keys are month nanes and vnose values are the number of days in the corresponding months, month = { "jan? : 31, "feb": 28, "march" : 31, "april": 30, "may": 31, "June": 30, july? 81, Yang" : SL, “sept? : 30, "oct" : 31, “nov: 30, "dec" : 31) ino, of days in the month, pon = inpuc(*Enter the month nane in short form :~ print ("Number of days in ",mon,"=",nonth ( moa ]) ‘heya in alphabetical order ‘Ist = list ( month . keys() } Ast. sort() print ( 1st ) #Month which have 31 days jprint( "Month which have 31 days ! for i in month : if month [4] == 31: print| i) ‘Month according to number of days | [print ("Month according to number of days ---") print ("feb") for i in month : if month [i] = 30 print (i) for 4 in month : if month [i] = 31: print ( i)(& Python 3.65 Shell File Edit Shell Debug Options Window Help Python 3.6.5 (v3.6.5:£59¢0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMDE4)] on win32 Type "copyright", "credits" or "license()" for more information. >>> RESTART: C:\Users\Leena\Downloads\monthS.py s=sss==sss=sss== Enver the month nane in short form i= dec Number of days in dec = 31 [rapesi', ‘aug! des", ‘feb', ‘gan', ‘uly’, ‘June’, tmazen! Month which have 31 days !!=- jan march may july car cet dec Monch according to number of days -—- feb apes june aere jan arch may july aos oct iso >>| ‘may', ‘nov’, ‘oct', ‘sept*][& cictonary 10) py -C\UserLeen| Download dictionary 10(Thpy (3.65) File Edt Fomat Run Options Window Help foreate a dictionary to store the name and contact nunbers of n nunber of friends and also to add a new friend, fupdate contact munber, delete a friend, search for a friend, view all the friends, sort the friends by their names Hin the dictionary dic = {} waite True : ane = input( "Enter name of friend :-") hone = int( input ("Enter phone nunber of friend : dic [name] * phone choice = input ("Enter Q to quit otherwise Af choice == "Q" or choice = "Yt break faroreate dictionary print () print ("2 Print (dic) fbradding item Print () print ("> :-*) mane = input( "Enter nane of friend to be added Phone = int (input ("Enter phone number of friend + dic [name] = phone int (dic) fordeleting item print() print (*¢ :-*) ane = input( "Enter nane of that friend which you want to delete del dic{ name } print (dic) fdiupdating value print () print ("4 :-") nane = input( "Enter nane of that friend which you vant to change his phone number Phone = int (input ("Enter phone nunber of friend :-" }) del dic [ name) ‘dic[ name ] = phone print (dic)(& dictionary 10 (1),py - C:\Users\Leena\Downloads\dictionary 10 (1).py (3.6.5) File Edit Format Run Options Window Help #etsearching item print () print ("e :-") name = input( "Enter name of that friend which you want to search : aif name in dic: print (" Found") else : print( "Not Found ") #f:new dictionary print () print ("f newdic = {} key = list( dic. keys()) key.sort() for i in key : newdic [i] =dic [i] print (newdic)| ")[i Python 3.65 Shell File Edt Shell Debug Options Window Help Python 3.6.5 (v3.6.5:£5%c0992b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMDE4)] on wins? ‘Type "copyright", "credits" or "License()" for more information, >> RESTART: C:\Users\Leena\Downloads\dicticnary 10 (1) .py s====eese== Enter name of friend : Enter phone nunber of friend :-9728655657 Enter Q to quit otherwise N Enter name of friend t-neha Enter phone number of friend Enter Q to quit otherwise N Enter name of friend :-saima Enter phone nunber of friend :-9736556365 Enter Q to quit otherwise N :-n Enter name of friend :~John Enver phone nunber of friend :-7634537656 Enter Q to quit otherwise W i-q aie (*diya': 9728655657, ‘neha’: 6254765735, ‘saima': 9736556365, ‘john’: 7634537656} bie Enter name of friend to be added :-madhav Enter phone nunber of friend :-2555655742 ("diya': 9728685657, ‘neha’: 8254765735, ‘saima': 9736556365, ‘john': 7634537656, ‘madhav': 8555655748) cis Enter name of that friend which you want to delete :-neha ("diya': 9728655657, ‘saima': 9736556365, "john": 7634537656, ‘madhav': 8555655748} dis Enter name of that friend which you want to change his phone number :-diya Enter phone number of friend :-9003232322 {"saima': 9736556365, 'john': 7634537656, ‘madhav': 8555655748, ‘diya’: 9003232322} en Enter name of that friend which you want to search :-john Found fie (*diya's 9003232322, "john': 7634537656, ‘madhav': @555655748, ‘saima': 9736556365} >>>
You might also like
Python Programming Lab (21AML38)
PDF
No ratings yet
Python Programming Lab (21AML38)
31 pages
Ix Ai Practicals 2022-23
PDF
No ratings yet
Ix Ai Practicals 2022-23
6 pages
Python ZTM Cheatsheet: Andrei Neagoie
PDF
100% (1)
Python ZTM Cheatsheet: Andrei Neagoie
38 pages
Unpack A Collection: "Orange" "Banana" "Cherry"
PDF
No ratings yet
Unpack A Collection: "Orange" "Banana" "Cherry"
37 pages
Py Record Final
PDF
No ratings yet
Py Record Final
32 pages
CS Project
PDF
No ratings yet
CS Project
11 pages
University of Engineering and Technology Taxila: Engr. Asma Shafi Muhammad Jarrar Mehdi (22-TE-04) OOP Lab Manuals
PDF
No ratings yet
University of Engineering and Technology Taxila: Engr. Asma Shafi Muhammad Jarrar Mehdi (22-TE-04) OOP Lab Manuals
26 pages
Report File 1
PDF
No ratings yet
Report File 1
41 pages
Arrays - Part3
PDF
No ratings yet
Arrays - Part3
27 pages
CS Practical XII 2024-25
PDF
No ratings yet
CS Practical XII 2024-25
22 pages
100 Helpful Python Tips You Can Learn Before Finishing Your Morning Coffee - by
PDF
No ratings yet
100 Helpful Python Tips You Can Learn Before Finishing Your Morning Coffee - by
108 pages
Nikhil Kumar Xiia 23 Computer Science
PDF
No ratings yet
Nikhil Kumar Xiia 23 Computer Science
18 pages
Python
PDF
No ratings yet
Python
33 pages
Phyton Preparation
PDF
No ratings yet
Phyton Preparation
62 pages
Ge8161-Lab Programs
PDF
No ratings yet
Ge8161-Lab Programs
37 pages
Program
PDF
No ratings yet
Program
33 pages
n16 Python Programs
PDF
No ratings yet
n16 Python Programs
23 pages
Python Practice
PDF
No ratings yet
Python Practice
36 pages
Python Practical 6-11
PDF
No ratings yet
Python Practical 6-11
15 pages
Python Tips
PDF
No ratings yet
Python Tips
33 pages
LEcture4 Tuples, List and Dict
PDF
No ratings yet
LEcture4 Tuples, List and Dict
33 pages
CS Practical, Himanshu Agrawal 11th A1
PDF
No ratings yet
CS Practical, Himanshu Agrawal 11th A1
18 pages
Python Assignment - 0744
PDF
No ratings yet
Python Assignment - 0744
14 pages
AIML Lab Manual
PDF
No ratings yet
AIML Lab Manual
39 pages
TSaiSrikar
PDF
No ratings yet
TSaiSrikar
45 pages
Lab Manual
PDF
No ratings yet
Lab Manual
54 pages
COMP
PDF
No ratings yet
COMP
15 pages
Python 3.6 Quick Reference Sheet
PDF
No ratings yet
Python 3.6 Quick Reference Sheet
2 pages
Python Practical
PDF
No ratings yet
Python Practical
20 pages
Different Python Interview Programs
PDF
No ratings yet
Different Python Interview Programs
10 pages
MTA Revision v1
PDF
No ratings yet
MTA Revision v1
30 pages
C S Practicals
PDF
No ratings yet
C S Practicals
18 pages
Cs Practiical-Merged PDF
PDF
No ratings yet
Cs Practiical-Merged PDF
15 pages
Python LAB File
PDF
No ratings yet
Python LAB File
19 pages
Final Lab Manual Python
PDF
No ratings yet
Final Lab Manual Python
32 pages
21CS202 - Lab Manual
PDF
No ratings yet
21CS202 - Lab Manual
18 pages
Python Basics
PDF
No ratings yet
Python Basics
49 pages
Python Cheatsheet
PDF
No ratings yet
Python Cheatsheet
30 pages
Function
PDF
No ratings yet
Function
9 pages
Harjot 19 - 34 Python
PDF
No ratings yet
Harjot 19 - 34 Python
20 pages
Python File
PDF
No ratings yet
Python File
23 pages
Computer Project Class 11 Cbse
PDF
No ratings yet
Computer Project Class 11 Cbse
9 pages
Python Lab Assignment Solution
PDF
No ratings yet
Python Lab Assignment Solution
17 pages
Pythonn
PDF
No ratings yet
Pythonn
12 pages
PYTHON TOUR 2 Type C
PDF
No ratings yet
PYTHON TOUR 2 Type C
7 pages
Topic 2 Homeworks
PDF
No ratings yet
Topic 2 Homeworks
9 pages
Working With Lists and Dictionaries: Back Exercise Question / Answer
PDF
No ratings yet
Working With Lists and Dictionaries: Back Exercise Question / Answer
11 pages
CS
PDF
No ratings yet
CS
8 pages
Final AI Lab Manual
PDF
No ratings yet
Final AI Lab Manual
30 pages
Code3 0
PDF
No ratings yet
Code3 0
28 pages
Python Final Lab 2019
PDF
No ratings yet
Python Final Lab 2019
35 pages
Practical Py
PDF
No ratings yet
Practical Py
26 pages
Python ZTM Cheatsheet: Andrei Neagoie
PDF
No ratings yet
Python ZTM Cheatsheet: Andrei Neagoie
38 pages
Lecture Python Basics
PDF
No ratings yet
Lecture Python Basics
23 pages
Here Are
PDF
No ratings yet
Here Are
6 pages
Iat 2
PDF
No ratings yet
Iat 2
3 pages
Pythonlabfilemk
PDF
No ratings yet
Pythonlabfilemk
17 pages
Python Cheatsheet 2
PDF
No ratings yet
Python Cheatsheet 2
4 pages