The document contains examples of Python code to solve common math and calculation problems by taking user input and printing outputs. These include calculating the area of a rectangle, area of a circle, converting between feet to inches, Fahrenheit to Celsius, and calculating the volume of a cylinder. The code segments demonstrate taking input, performing calculations, and printing results.
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
0 ratings0% found this document useful (0 votes)
42 views
AI Python Practical
The document contains examples of Python code to solve common math and calculation problems by taking user input and printing outputs. These include calculating the area of a rectangle, area of a circle, converting between feet to inches, Fahrenheit to Celsius, and calculating the volume of a cylinder. The code segments demonstrate taking input, performing calculations, and printing results.
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/ 12
Pylhen Paaclical Page No.
1NAPtoenler length and
reclangle breadth and calculale area 1. Lenglh = Breadth -= int(inputEnter intlinpui"Enter Lenqth: Breadth:") Area (Lengih* Breadth)_ print ( he area ot kecfangle is", Hrea) un nEwe C:\Users\hp\AppData\Local\Microsoft\WindowsApps\python3.9.exe C:/Users/np/PycharaProjects//tirstprog/new2.py Enter Length 8 Enter Breadth : The Area of Rectangle is 72 Process finished with exit code 6
RunE TODO Problems Terminal Python Console Event Log9
PEP 8 W292 no newline at end of fie 7:1 CRLF UTF-8 4spaces Python 39 WAP To enler radius of circle_and calculate area ooff circle.
Kadius =inI(inpu Enter Radius :")
prinI.14 Radius ** 2) Run newc \Users\np\Appbata\ Local \Microsoft\WindowsApps\python3. 9.exe c:/Users/np/PycharaProjects/firstprog/new2.py Enter Radius 153.86
Processfinished with exit code 0
Run E TODO Problems Terminal Python Console Event Log
OPEP &: W292 no newline at end offile 61 Python 39 WAP enter Name, marks_af 5 tolal &percenlage of sluden Subjeci and calculate -/p Name inpul Enler your name \n SubjecTE int(inpul(Enler Marks ot Subjeci i_ou d 100 \n") Subjecl2 inilinpuil( Enler Marks_ot Subjeci 2 ouf of 100 2)) SubjecT3= intlinpuITnler Marks of SubjecT 3 6UT of 100 n)) SubjectintlinpuEater Marks of Oubjec[ 1_ou of 100 \n)) Oubiect5= intlinpui Enler Marks of Sukject_5 sut of 100 otal E (Subiecti+ Subject2+Subject3 +Subjecth: Subject5 Fercenf= (Total/500 *100) prinl (Name, has acquired olal marks and ercenT PercenTage" Teacher's Signature C:\Users \hp\Appbata\Local \Microsoft\WindowsApps\python3.9.exe C:/Users/hp/PycharaProjects/firstprog/new2.py thter your name Onanno Enter Marks of Subject 1 out of 188 Enter Marks of Subject 2out of 100 Enter Marks of Subject 3out of 180 Enter Marks of Subject 4 out of 16
Enter Harks of Subject 5 out of 180
Chaand Chharia has acquired 438 marks and 87.6 Percentage Processfinished with exit code
Run TODO Probiems Terminal Python Console Event Log
171 CRLF UTE-8 4spaces Python 39 ate
Expt. No. Page No.
4WAP f enfer distance in feef and convert itinto inches.
Feetinftlinpuf("Enter The measure_in Feef\n2)) Inches=Feet*12) Lprint(50, fhe number of nches_in, Feei, "feeTs are lnches) Run new C:\Users\np\Appbata\Local\Microsoft\WindowsApps \python3. 9.exeC:/Users/hp/PycharmProjects/firstprog/new2.py Enter the measure in Feet So, the number of Inches in 7 feets are 84 Process finished with exit code 0
Run ETODO Problems Terminal Python Console QEvent Lo
6:34 CRLF UTF-8 4 spaces Python 39 5 To enler value ot femperaure in_Farenheit and convert ConverI it it inlo Celsius. Faceheit flbat (inputEnter femperature in degree farenheif \r Celsius (Farenheit 32)* 5/9) prinIlemperalure in deqree celsus ist,lelsius) Run newC
C:\Users\np\AppData\ Local \Microsoft \WindowsApps \python3. 9.exe C:/Users/np/PycharnProjects/firstprog/new2. py
Enter temprature in degree farenheits Temperature in degree celsius is 31.11111111111111 Process finished with exit code 0
Run ETODo Problems Terminal Python Console Event Log
Python 3.9 6WHP Ta enler radius and height ot cylinder and calculale volume of culinder. Radius flaat linput(Eater Radius at the Cylinder \n Heighi= flaat linput ("Enter Heioht at the Culinder An) Volume .14 *Radius** 2 * Heiqht prini(Ihe valume ot the culinder islf Volume) Run