SlideShare a Scribd company logo
def main():
print('enter the option')
print('1: celsius to fahrenheit')
print('2: fahrenheit to celsius')
o=int(input('emter the option'))
if(o==1):
c=float(input('emter celsius'))
f=float((9.0/5.0))*c+32
print('fharenheit',f)
else:
f=float(input('enter fharenheit'))
c=float(5.0/9.0)*(f-32.0)
print('celsius',c)
if __name__=='__main__':
main()
1.TEMPERATURE CONVERSION
Print Function & Input Function
Fahrenheit Declared Function
Fahrenheit Declared Function
if…else function
Call Main Funtion
Mr. V. VEERANAN, M.Sc. Computer Science., Dip.in.Yoga.,
def areasquare(a):
area=a*a
return(area)
def arearectangle(l,b):
a=l*b
return(a)
def areacircle(r):
import math
a1=math.pi*r*r
return(a1)
def areatriangle(b,h):
a2=float(0.5*b*h)
return(a2)
def main():
print('enter your option')
print('1. enter area of square')
print('2. enter area of rectangle')
print('3. enter area of circle')
print('4. enter area of triangle')
1 2
2.AREA OF THE SHAPES
Square
Rectangle
Circle
Triangle
Print Function
Mr. V. VEERANAN, M.Sc. Computer Science., Dip.in.Yoga.,
o=int(input('enter your option'))
if(o==1):
a=int(input('enter area'))
x=areasquare(a)
print('area of square',x)
elif(o==2):
l1=int(input('enter length'))
b1=int(input('enter breath'))
y=arearectangle(l1,b1)
print('area of rectangel',y)
elif(o==3):
r=int(input('enter a circle'))
z=areacircle(r)
print('area of circle',z)
elif(o==4):
b1=int(input('enter the breath'))
h1=float(input('enter the heigth'))
aa=areatriangle(b1,h1)
print('area of triangle',aa)
if __name__=='__main__':
main()
3 4
2. AREA OF THE SHAPES
Square
Rectangle
Circle
Triangle
Mr. V. VEERANAN, M.Sc. Computer Science., Dip.in.Yoga.,
def main():
print('enter the marks')
m1=float(input('tamil'))
m2=float(input('english'))
m3=float(input('computer'))
t=m1+m2+m3
p=(t/300)*100
print('mark obtained in tamil',m1)
print('mark obtained in english',m2)
print('mark obtained in computer',m3)
print('total marks in 3 subjects',t)
print('percentage',p)
if(p>=80):
print('grade A')
elif(p>70 and p<80):
print('grade B')
elif(p>60 and p<70):
print('grade C')
elif(p>40 and p<60):
print('grade d')
elif(p<40):
print('grade E')
if __name__=='__main__':
main()
3. PERCENTAGE
Print & Marks
Print
Grade A
Grade B
Grade C
Grade D
Grade E
Mr. V. VEERANAN, M.Sc. Computer Science., Dip.in.Yoga.,
def main():
print('fibonacci series')
n=int(input('enter the range'))
a=1
b=2
print(a)
print(b)
for i in range(n+1):
c=a+b
print(c)
a=b
b=c
if __name__=='__main__':
main()
4. FIBONACCI SERIES
Print & Declare
Print Range
Mr. V. VEERANAN, M.Sc. Computer Science., Dip.in.Yoga.,
def main():
n=int(input('enter the factorial of number:'))
fact=1
for i in range(1,n+1):
fact=fact*1
print('factorial of the number %d is %d',(n,fact))
if __name__=='__main__':
main()
5. FACTORIAL PROGRAM
Input
Print range
Mr. V. VEERANAN, M.Sc. Computer Science., Dip.in.Yoga.,
def facto(n):
fact=1
for i in range(1,n+1):
fact=fact*i
return fact
def main():
n=int(input('enter the value'))
sum=0.0
for i in range(1,n+1):
if(i%2==0):
sum=float(sum)-float(i)/float(facto(i))
else:
sum=float(sum)+float(i)/float(facto(i))
print('sum of the series',round(sum,3))
if __name__=='__main__':
main()
6. SUM OF SERIES
Mr. V. VEERANAN, M.Sc. Computer Science., Dip.in.Yoga.,
Range
Sum
if
else
import matplotlib.pyplot as plt
def plothistogram(data):
plt.hist(data)
plt.xlabel('value')
plt.ylabel('Frequency')
plt.title('histogram')
plt.xlim(min(data)-1,max(data)+1)
plt.show()
def main():
data=eval(input('enter data to be plotted as histogram:'))
plothistogram(data)
if __name__=='__main__':
main()
7. HISTOGRAM
Mr. V. VEERANAN, M.Sc. Computer Science., Dip.in.Yoga.,
Package
Value & Limed
Print
import matplotlib.pyplot as plt
import math
def sinecurve():
plt.subplot(2,1,1)
degrees=range(0,360+1)
sinevalues=[math.sin(math.radians (i))for i in degrees]
plt.plot(sinevalues)
plt.xlabel('degrees')
plt.ylabel('sine value')
plt.title('sine curve')
plt.grid()
8. SINE AND COSINE
Mr. V. VEERANAN, M.Sc. Computer Science., Dip.in.Yoga.,
Package
Sine
def cosinecurve():
plt.subplot(2,1,2)
degrees=range(0,360+1)
cosinevalues=[math.cos(math.radians (i))for i in degrees]
plt.plot(cosinevalues)
plt.xlabel('degrees')
plt.ylabel('cosine value')
plt.title('cosine curve')
plt.grid()
def main():
sinecurve()
cosinecurve()
plt.tight_layout()
plt.show()
if __name__=='__main__':
main()
8. SINE AND COSINE
Mr. V. VEERANAN, M.Sc. Computer Science., Dip.in.Yoga.,
Cosine
Main

More Related Content

Similar to Lab 3 Python Programming Lab 1-8 MKU.pdf

PYTHON_PROGRAM(1-34).pdf
PYTHON_PROGRAM(1-34).pdfPYTHON_PROGRAM(1-34).pdf
PYTHON_PROGRAM(1-34).pdf
Neeraj381934
 
14 recursion
14 recursion14 recursion
14 recursion
Himadri Sen Gupta
 
Go: It's Not Just For Google
Go: It's Not Just For GoogleGo: It's Not Just For Google
Go: It's Not Just For Google
Eleanor McHugh
 
Laziness, trampolines, monoids and other functional amenities: this is not yo...
Laziness, trampolines, monoids and other functional amenities: this is not yo...Laziness, trampolines, monoids and other functional amenities: this is not yo...
Laziness, trampolines, monoids and other functional amenities: this is not yo...Mario Fusco
 
Python programs - first semester computer lab manual (polytechnics)
Python programs - first semester computer lab manual (polytechnics)Python programs - first semester computer lab manual (polytechnics)
Python programs - first semester computer lab manual (polytechnics)
SHAMJITH KM
 
Python programs - PPT file (Polytechnics)
Python programs - PPT file (Polytechnics)Python programs - PPT file (Polytechnics)
Python programs - PPT file (Polytechnics)
SHAMJITH KM
 
III MCS python lab (1).pdf
III MCS python lab (1).pdfIII MCS python lab (1).pdf
III MCS python lab (1).pdf
srxerox
 
Python Programming
Python Programming Python Programming
Python Programming
Sreedhar Chowdam
 
python practicals-solution-2019-20-class-xii.pdf
python practicals-solution-2019-20-class-xii.pdfpython practicals-solution-2019-20-class-xii.pdf
python practicals-solution-2019-20-class-xii.pdf
rajatxyz
 
L25-L26-Parameter passing techniques.pptx
L25-L26-Parameter passing techniques.pptxL25-L26-Parameter passing techniques.pptx
L25-L26-Parameter passing techniques.pptx
happycocoman
 
Forward & Backward Differenece Table
Forward & Backward Differenece TableForward & Backward Differenece Table
Forward & Backward Differenece Table
Saloni Singhal
 
Introductory part of function for class 12th JEE
Introductory part of function for class 12th JEEIntroductory part of function for class 12th JEE
Introductory part of function for class 12th JEE
MohanSonawane
 
A New Double Numerical Integration Formula Based On The First Order Derivative
A New Double Numerical Integration Formula Based On The First Order DerivativeA New Double Numerical Integration Formula Based On The First Order Derivative
A New Double Numerical Integration Formula Based On The First Order Derivative
IRJESJOURNAL
 
Python programming workshop session 4
Python programming workshop session 4Python programming workshop session 4
Python programming workshop session 4
Abdul Haseeb
 
Opt simple single_000
Opt simple single_000Opt simple single_000
Opt simple single_000
sheetslibrary
 
ملخص البرمجة المرئية - الوحدة الخامسة
ملخص البرمجة المرئية - الوحدة الخامسةملخص البرمجة المرئية - الوحدة الخامسة
ملخص البرمجة المرئية - الوحدة الخامسة
جامعة القدس المفتوحة
 
Drinking the free kool-aid
Drinking the free kool-aidDrinking the free kool-aid
Drinking the free kool-aid
David Hoyt
 
3 kotlin vs. java- what kotlin has that java does not
3  kotlin vs. java- what kotlin has that java does not3  kotlin vs. java- what kotlin has that java does not
3 kotlin vs. java- what kotlin has that java does not
Sergey Bandysik
 
Implementing the IO Monad in Scala
Implementing the IO Monad in ScalaImplementing the IO Monad in Scala
Implementing the IO Monad in Scala
Hermann Hueck
 

Similar to Lab 3 Python Programming Lab 1-8 MKU.pdf (20)

PYTHON_PROGRAM(1-34).pdf
PYTHON_PROGRAM(1-34).pdfPYTHON_PROGRAM(1-34).pdf
PYTHON_PROGRAM(1-34).pdf
 
14 recursion
14 recursion14 recursion
14 recursion
 
Go: It's Not Just For Google
Go: It's Not Just For GoogleGo: It's Not Just For Google
Go: It's Not Just For Google
 
Laziness, trampolines, monoids and other functional amenities: this is not yo...
Laziness, trampolines, monoids and other functional amenities: this is not yo...Laziness, trampolines, monoids and other functional amenities: this is not yo...
Laziness, trampolines, monoids and other functional amenities: this is not yo...
 
Python programs - first semester computer lab manual (polytechnics)
Python programs - first semester computer lab manual (polytechnics)Python programs - first semester computer lab manual (polytechnics)
Python programs - first semester computer lab manual (polytechnics)
 
Python programs - PPT file (Polytechnics)
Python programs - PPT file (Polytechnics)Python programs - PPT file (Polytechnics)
Python programs - PPT file (Polytechnics)
 
III MCS python lab (1).pdf
III MCS python lab (1).pdfIII MCS python lab (1).pdf
III MCS python lab (1).pdf
 
Python Programming
Python Programming Python Programming
Python Programming
 
python practicals-solution-2019-20-class-xii.pdf
python practicals-solution-2019-20-class-xii.pdfpython practicals-solution-2019-20-class-xii.pdf
python practicals-solution-2019-20-class-xii.pdf
 
L25-L26-Parameter passing techniques.pptx
L25-L26-Parameter passing techniques.pptxL25-L26-Parameter passing techniques.pptx
L25-L26-Parameter passing techniques.pptx
 
Forward & Backward Differenece Table
Forward & Backward Differenece TableForward & Backward Differenece Table
Forward & Backward Differenece Table
 
Introductory part of function for class 12th JEE
Introductory part of function for class 12th JEEIntroductory part of function for class 12th JEE
Introductory part of function for class 12th JEE
 
A New Double Numerical Integration Formula Based On The First Order Derivative
A New Double Numerical Integration Formula Based On The First Order DerivativeA New Double Numerical Integration Formula Based On The First Order Derivative
A New Double Numerical Integration Formula Based On The First Order Derivative
 
Python programming workshop session 4
Python programming workshop session 4Python programming workshop session 4
Python programming workshop session 4
 
Opt simple single_000
Opt simple single_000Opt simple single_000
Opt simple single_000
 
ملخص البرمجة المرئية - الوحدة الخامسة
ملخص البرمجة المرئية - الوحدة الخامسةملخص البرمجة المرئية - الوحدة الخامسة
ملخص البرمجة المرئية - الوحدة الخامسة
 
Drinking the free kool-aid
Drinking the free kool-aidDrinking the free kool-aid
Drinking the free kool-aid
 
3 kotlin vs. java- what kotlin has that java does not
3  kotlin vs. java- what kotlin has that java does not3  kotlin vs. java- what kotlin has that java does not
3 kotlin vs. java- what kotlin has that java does not
 
6. function
6. function6. function
6. function
 
Implementing the IO Monad in Scala
Implementing the IO Monad in ScalaImplementing the IO Monad in Scala
Implementing the IO Monad in Scala
 

More from CUO VEERANAN VEERANAN

Big Data - large Scale data (Amazon, FB)
Big Data - large Scale data (Amazon, FB)Big Data - large Scale data (Amazon, FB)
Big Data - large Scale data (Amazon, FB)
CUO VEERANAN VEERANAN
 
Fourier Transforms are indispensable tool
Fourier Transforms are indispensable toolFourier Transforms are indispensable tool
Fourier Transforms are indispensable tool
CUO VEERANAN VEERANAN
 
ENHANCING BIOLOGICAL RESEARCH THROUGH DIGITAL TECHNOLOGIES AND COMPUTATIONAL.ppt
ENHANCING BIOLOGICAL RESEARCH THROUGH DIGITAL TECHNOLOGIES AND COMPUTATIONAL.pptENHANCING BIOLOGICAL RESEARCH THROUGH DIGITAL TECHNOLOGIES AND COMPUTATIONAL.ppt
ENHANCING BIOLOGICAL RESEARCH THROUGH DIGITAL TECHNOLOGIES AND COMPUTATIONAL.ppt
CUO VEERANAN VEERANAN
 
ADS_Unit I_Route Map 2023.pdf
ADS_Unit I_Route Map 2023.pdfADS_Unit I_Route Map 2023.pdf
ADS_Unit I_Route Map 2023.pdf
CUO VEERANAN VEERANAN
 
CS 23 Operating System Design Principles_MULTIPROCESSOR AND REAL TIME SCHEDULING
CS 23 Operating System Design Principles_MULTIPROCESSOR AND REAL TIME SCHEDULINGCS 23 Operating System Design Principles_MULTIPROCESSOR AND REAL TIME SCHEDULING
CS 23 Operating System Design Principles_MULTIPROCESSOR AND REAL TIME SCHEDULING
CUO VEERANAN VEERANAN
 
Python Unit I MCQ.ppt
Python Unit I MCQ.pptPython Unit I MCQ.ppt
Python Unit I MCQ.ppt
CUO VEERANAN VEERANAN
 
GAC DS Priority Queue Presentation 2022.ppt
GAC DS Priority Queue Presentation 2022.pptGAC DS Priority Queue Presentation 2022.ppt
GAC DS Priority Queue Presentation 2022.ppt
CUO VEERANAN VEERANAN
 
GAC Java Presentation_Server Side Include_Cookies_Filters 2022.ppt
GAC Java Presentation_Server Side Include_Cookies_Filters 2022.pptGAC Java Presentation_Server Side Include_Cookies_Filters 2022.ppt
GAC Java Presentation_Server Side Include_Cookies_Filters 2022.ppt
CUO VEERANAN VEERANAN
 
Lab 3 Python Programming Lab 8-15 MKU.pdf
Lab 3 Python Programming Lab 8-15 MKU.pdfLab 3 Python Programming Lab 8-15 MKU.pdf
Lab 3 Python Programming Lab 8-15 MKU.pdf
CUO VEERANAN VEERANAN
 
MULTIPROCESSOR AND REAL TIME SCHEDULING.ppt
MULTIPROCESSOR AND REAL TIME SCHEDULING.pptMULTIPROCESSOR AND REAL TIME SCHEDULING.ppt
MULTIPROCESSOR AND REAL TIME SCHEDULING.ppt
CUO VEERANAN VEERANAN
 
Relational Algebra.ppt
Relational Algebra.pptRelational Algebra.ppt
Relational Algebra.ppt
CUO VEERANAN VEERANAN
 
DS Unit I to III MKU Questions.pdf
DS Unit I to III MKU Questions.pdfDS Unit I to III MKU Questions.pdf
DS Unit I to III MKU Questions.pdf
CUO VEERANAN VEERANAN
 
Acharya Vinoba Bhave.ppt
Acharya Vinoba Bhave.pptAcharya Vinoba Bhave.ppt
Acharya Vinoba Bhave.ppt
CUO VEERANAN VEERANAN
 
1.1.8 Types of computer & 1.1.8.3 Classification of Computers on the basis of...
1.1.8 Types of computer & 1.1.8.3 Classification of Computers on the basis of...1.1.8 Types of computer & 1.1.8.3 Classification of Computers on the basis of...
1.1.8 Types of computer & 1.1.8.3 Classification of Computers on the basis of...
CUO VEERANAN VEERANAN
 
1.1.8 Types of computer & 1.1.8.2 Classification of Computers on the basis of...
1.1.8 Types of computer & 1.1.8.2 Classification of Computers on the basis of...1.1.8 Types of computer & 1.1.8.2 Classification of Computers on the basis of...
1.1.8 Types of computer & 1.1.8.2 Classification of Computers on the basis of...
CUO VEERANAN VEERANAN
 
1.1.8 Types of computer & 1.1.8.1 Classification of Computers on the basis of...
1.1.8 Types of computer & 1.1.8.1 Classification of Computers on the basis of...1.1.8 Types of computer & 1.1.8.1 Classification of Computers on the basis of...
1.1.8 Types of computer & 1.1.8.1 Classification of Computers on the basis of...
CUO VEERANAN VEERANAN
 
1.1.7 Block diagram and Working Principle of Computer
1.1.7 Block diagram and Working Principle of Computer1.1.7 Block diagram and Working Principle of Computer
1.1.7 Block diagram and Working Principle of Computer
CUO VEERANAN VEERANAN
 
1.1.6 Characteristics of Computer
1.1.6 Characteristics of Computer1.1.6 Characteristics of Computer
1.1.6 Characteristics of Computer
CUO VEERANAN VEERANAN
 
1.1.5 Terms related to Computer & 1.1.5.3 Technical Industry
1.1.5 Terms related to Computer & 1.1.5.3 Technical Industry1.1.5 Terms related to Computer & 1.1.5.3 Technical Industry
1.1.5 Terms related to Computer & 1.1.5.3 Technical Industry
CUO VEERANAN VEERANAN
 
1.1.5 Terms related to Computer & 1.1.5.2 Software.ppt
1.1.5 Terms related to Computer & 1.1.5.2 Software.ppt1.1.5 Terms related to Computer & 1.1.5.2 Software.ppt
1.1.5 Terms related to Computer & 1.1.5.2 Software.ppt
CUO VEERANAN VEERANAN
 

More from CUO VEERANAN VEERANAN (20)

Big Data - large Scale data (Amazon, FB)
Big Data - large Scale data (Amazon, FB)Big Data - large Scale data (Amazon, FB)
Big Data - large Scale data (Amazon, FB)
 
Fourier Transforms are indispensable tool
Fourier Transforms are indispensable toolFourier Transforms are indispensable tool
Fourier Transforms are indispensable tool
 
ENHANCING BIOLOGICAL RESEARCH THROUGH DIGITAL TECHNOLOGIES AND COMPUTATIONAL.ppt
ENHANCING BIOLOGICAL RESEARCH THROUGH DIGITAL TECHNOLOGIES AND COMPUTATIONAL.pptENHANCING BIOLOGICAL RESEARCH THROUGH DIGITAL TECHNOLOGIES AND COMPUTATIONAL.ppt
ENHANCING BIOLOGICAL RESEARCH THROUGH DIGITAL TECHNOLOGIES AND COMPUTATIONAL.ppt
 
ADS_Unit I_Route Map 2023.pdf
ADS_Unit I_Route Map 2023.pdfADS_Unit I_Route Map 2023.pdf
ADS_Unit I_Route Map 2023.pdf
 
CS 23 Operating System Design Principles_MULTIPROCESSOR AND REAL TIME SCHEDULING
CS 23 Operating System Design Principles_MULTIPROCESSOR AND REAL TIME SCHEDULINGCS 23 Operating System Design Principles_MULTIPROCESSOR AND REAL TIME SCHEDULING
CS 23 Operating System Design Principles_MULTIPROCESSOR AND REAL TIME SCHEDULING
 
Python Unit I MCQ.ppt
Python Unit I MCQ.pptPython Unit I MCQ.ppt
Python Unit I MCQ.ppt
 
GAC DS Priority Queue Presentation 2022.ppt
GAC DS Priority Queue Presentation 2022.pptGAC DS Priority Queue Presentation 2022.ppt
GAC DS Priority Queue Presentation 2022.ppt
 
GAC Java Presentation_Server Side Include_Cookies_Filters 2022.ppt
GAC Java Presentation_Server Side Include_Cookies_Filters 2022.pptGAC Java Presentation_Server Side Include_Cookies_Filters 2022.ppt
GAC Java Presentation_Server Side Include_Cookies_Filters 2022.ppt
 
Lab 3 Python Programming Lab 8-15 MKU.pdf
Lab 3 Python Programming Lab 8-15 MKU.pdfLab 3 Python Programming Lab 8-15 MKU.pdf
Lab 3 Python Programming Lab 8-15 MKU.pdf
 
MULTIPROCESSOR AND REAL TIME SCHEDULING.ppt
MULTIPROCESSOR AND REAL TIME SCHEDULING.pptMULTIPROCESSOR AND REAL TIME SCHEDULING.ppt
MULTIPROCESSOR AND REAL TIME SCHEDULING.ppt
 
Relational Algebra.ppt
Relational Algebra.pptRelational Algebra.ppt
Relational Algebra.ppt
 
DS Unit I to III MKU Questions.pdf
DS Unit I to III MKU Questions.pdfDS Unit I to III MKU Questions.pdf
DS Unit I to III MKU Questions.pdf
 
Acharya Vinoba Bhave.ppt
Acharya Vinoba Bhave.pptAcharya Vinoba Bhave.ppt
Acharya Vinoba Bhave.ppt
 
1.1.8 Types of computer & 1.1.8.3 Classification of Computers on the basis of...
1.1.8 Types of computer & 1.1.8.3 Classification of Computers on the basis of...1.1.8 Types of computer & 1.1.8.3 Classification of Computers on the basis of...
1.1.8 Types of computer & 1.1.8.3 Classification of Computers on the basis of...
 
1.1.8 Types of computer & 1.1.8.2 Classification of Computers on the basis of...
1.1.8 Types of computer & 1.1.8.2 Classification of Computers on the basis of...1.1.8 Types of computer & 1.1.8.2 Classification of Computers on the basis of...
1.1.8 Types of computer & 1.1.8.2 Classification of Computers on the basis of...
 
1.1.8 Types of computer & 1.1.8.1 Classification of Computers on the basis of...
1.1.8 Types of computer & 1.1.8.1 Classification of Computers on the basis of...1.1.8 Types of computer & 1.1.8.1 Classification of Computers on the basis of...
1.1.8 Types of computer & 1.1.8.1 Classification of Computers on the basis of...
 
1.1.7 Block diagram and Working Principle of Computer
1.1.7 Block diagram and Working Principle of Computer1.1.7 Block diagram and Working Principle of Computer
1.1.7 Block diagram and Working Principle of Computer
 
1.1.6 Characteristics of Computer
1.1.6 Characteristics of Computer1.1.6 Characteristics of Computer
1.1.6 Characteristics of Computer
 
1.1.5 Terms related to Computer & 1.1.5.3 Technical Industry
1.1.5 Terms related to Computer & 1.1.5.3 Technical Industry1.1.5 Terms related to Computer & 1.1.5.3 Technical Industry
1.1.5 Terms related to Computer & 1.1.5.3 Technical Industry
 
1.1.5 Terms related to Computer & 1.1.5.2 Software.ppt
1.1.5 Terms related to Computer & 1.1.5.2 Software.ppt1.1.5 Terms related to Computer & 1.1.5.2 Software.ppt
1.1.5 Terms related to Computer & 1.1.5.2 Software.ppt
 

Recently uploaded

Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
CarlosHernanMontoyab2
 

Recently uploaded (20)

Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
 

Lab 3 Python Programming Lab 1-8 MKU.pdf

  • 1. def main(): print('enter the option') print('1: celsius to fahrenheit') print('2: fahrenheit to celsius') o=int(input('emter the option')) if(o==1): c=float(input('emter celsius')) f=float((9.0/5.0))*c+32 print('fharenheit',f) else: f=float(input('enter fharenheit')) c=float(5.0/9.0)*(f-32.0) print('celsius',c) if __name__=='__main__': main() 1.TEMPERATURE CONVERSION Print Function & Input Function Fahrenheit Declared Function Fahrenheit Declared Function if…else function Call Main Funtion Mr. V. VEERANAN, M.Sc. Computer Science., Dip.in.Yoga.,
  • 2. def areasquare(a): area=a*a return(area) def arearectangle(l,b): a=l*b return(a) def areacircle(r): import math a1=math.pi*r*r return(a1) def areatriangle(b,h): a2=float(0.5*b*h) return(a2) def main(): print('enter your option') print('1. enter area of square') print('2. enter area of rectangle') print('3. enter area of circle') print('4. enter area of triangle') 1 2 2.AREA OF THE SHAPES Square Rectangle Circle Triangle Print Function Mr. V. VEERANAN, M.Sc. Computer Science., Dip.in.Yoga.,
  • 3. o=int(input('enter your option')) if(o==1): a=int(input('enter area')) x=areasquare(a) print('area of square',x) elif(o==2): l1=int(input('enter length')) b1=int(input('enter breath')) y=arearectangle(l1,b1) print('area of rectangel',y) elif(o==3): r=int(input('enter a circle')) z=areacircle(r) print('area of circle',z) elif(o==4): b1=int(input('enter the breath')) h1=float(input('enter the heigth')) aa=areatriangle(b1,h1) print('area of triangle',aa) if __name__=='__main__': main() 3 4 2. AREA OF THE SHAPES Square Rectangle Circle Triangle Mr. V. VEERANAN, M.Sc. Computer Science., Dip.in.Yoga.,
  • 4. def main(): print('enter the marks') m1=float(input('tamil')) m2=float(input('english')) m3=float(input('computer')) t=m1+m2+m3 p=(t/300)*100 print('mark obtained in tamil',m1) print('mark obtained in english',m2) print('mark obtained in computer',m3) print('total marks in 3 subjects',t) print('percentage',p) if(p>=80): print('grade A') elif(p>70 and p<80): print('grade B') elif(p>60 and p<70): print('grade C') elif(p>40 and p<60): print('grade d') elif(p<40): print('grade E') if __name__=='__main__': main() 3. PERCENTAGE Print & Marks Print Grade A Grade B Grade C Grade D Grade E Mr. V. VEERANAN, M.Sc. Computer Science., Dip.in.Yoga.,
  • 5. def main(): print('fibonacci series') n=int(input('enter the range')) a=1 b=2 print(a) print(b) for i in range(n+1): c=a+b print(c) a=b b=c if __name__=='__main__': main() 4. FIBONACCI SERIES Print & Declare Print Range Mr. V. VEERANAN, M.Sc. Computer Science., Dip.in.Yoga.,
  • 6. def main(): n=int(input('enter the factorial of number:')) fact=1 for i in range(1,n+1): fact=fact*1 print('factorial of the number %d is %d',(n,fact)) if __name__=='__main__': main() 5. FACTORIAL PROGRAM Input Print range Mr. V. VEERANAN, M.Sc. Computer Science., Dip.in.Yoga.,
  • 7. def facto(n): fact=1 for i in range(1,n+1): fact=fact*i return fact def main(): n=int(input('enter the value')) sum=0.0 for i in range(1,n+1): if(i%2==0): sum=float(sum)-float(i)/float(facto(i)) else: sum=float(sum)+float(i)/float(facto(i)) print('sum of the series',round(sum,3)) if __name__=='__main__': main() 6. SUM OF SERIES Mr. V. VEERANAN, M.Sc. Computer Science., Dip.in.Yoga., Range Sum if else
  • 8. import matplotlib.pyplot as plt def plothistogram(data): plt.hist(data) plt.xlabel('value') plt.ylabel('Frequency') plt.title('histogram') plt.xlim(min(data)-1,max(data)+1) plt.show() def main(): data=eval(input('enter data to be plotted as histogram:')) plothistogram(data) if __name__=='__main__': main() 7. HISTOGRAM Mr. V. VEERANAN, M.Sc. Computer Science., Dip.in.Yoga., Package Value & Limed Print
  • 9. import matplotlib.pyplot as plt import math def sinecurve(): plt.subplot(2,1,1) degrees=range(0,360+1) sinevalues=[math.sin(math.radians (i))for i in degrees] plt.plot(sinevalues) plt.xlabel('degrees') plt.ylabel('sine value') plt.title('sine curve') plt.grid() 8. SINE AND COSINE Mr. V. VEERANAN, M.Sc. Computer Science., Dip.in.Yoga., Package Sine
  • 10. def cosinecurve(): plt.subplot(2,1,2) degrees=range(0,360+1) cosinevalues=[math.cos(math.radians (i))for i in degrees] plt.plot(cosinevalues) plt.xlabel('degrees') plt.ylabel('cosine value') plt.title('cosine curve') plt.grid() def main(): sinecurve() cosinecurve() plt.tight_layout() plt.show() if __name__=='__main__': main() 8. SINE AND COSINE Mr. V. VEERANAN, M.Sc. Computer Science., Dip.in.Yoga., Cosine Main