0% found this document useful (0 votes)
3 views4 pages

Applications Development Using Python

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

Applications Development Using Python

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

APPLICATIONS DEVELOPMENT USING PYTHON

LAB MANUAL
1. Write a menu driven program to convert the given
temperature from
Fahrenheit to Celsius to kelvin and vice versa depending
upon user's
choice.

Program:
def fahrenheit_to_celsius(f):

return (f - 32) * 5 / 9
def celsius_to_fahrenheit(c):
return (c * 9 / 5) + 32
def celsius_to_kelvin(c):
return c + 273.15
def kelvin_to_celsius(k):
return k - 273.15
def fahrenheit_to_kelvin(f):
return fahrenheit_to_celsius(f) + 273.15
def kelvin_to_fahrenheit(k):
return celsius_to_fahrenheit(kelvin_to_celsius(k))
while True:
print("\n--- Temperature Conversion Menu ---")
print("1. Fahrenheit to Celsius")
print("2. Celsius to Fahrenheit")
print("3. Celsius to Kelvin")
print("4. Kelvin to Celsius")
print("5. Fahrenheit to Kelvin")
print("6. Kelvin to Fahrenheit")
print("7. Exit")
choice = int(input("Enter your choice (1-7): "))
if choice == 1:
f = float(input("Enter temperature in Fahrenheit: "))
print("Temperature in Celsius:", fahrenheit_to_celsius(f))
elif choice == 2:
c = float(input("Enter temperature in Celsius: "))
print("Temperature in Fahrenheit:", celsius_to_fahrenheit(c)) elif
choice == 3:
c = float(input("Enter temperature in Celsius: "))
print("Temperature in Kelvin:", celsius_to_kelvin(c))
elif choice == 4:
k = float(input("Enter temperature in Kelvin: "))
print("Temperature in Celsius:", kelvin_to_celsius(k))
elif choice == 5:
f = float(input("Enter temperature in Fahrenheit: "))
print("Temperature in Kelvin:", fahrenheit_to_kelvin(f))
elif choice == 6:
k = float(input("Enter temperature in Kelvin: "))
print("Temperature in Fahrenheit:", kelvin_to_fahrenheit(k))
elif choice == 7:
print("Exiting the program. Goodbye!")
break
else:
print("Invalid choice! Please enter a number between 1 and 7.")

OUTPUT:
[Link] a python program to calculate total marks, percentage and grade of a
student .Marks obtained in each of the three subjects are to be input by the
user. Assign grades according to the following criteria:

Program:
d_s=float(input("E

ntermarksford_s:")

python=float(input(

"Entermarksforpyth

on:"))

html=float(input("Entermarksforhtml:"))
php=float(input("Entermarksforphp:"))
mathsA=float(input("EntermarksformathsA:"))
mathsB=float(input("EntermarksformathsB:"))
total=d_s+python+html+php+mathsA+mathsB
percentage=(total/600)
ifpercentag
e>=80:
grade =
'A'
elifpercentage
>=70:
grade = 'B'
elifpercentage
>=60:
grade = 'C'
elifpercentage
>=40:
grade = 'D'
else:
grade='E'
print("\n---StudentResult---")
print("MarksinSubject1:",d_s)
print("MarksinSubject2:",pyth
on)
print("MarksinSubject3:",html
)
print("MarksinSubject4:",php)
print("MarksinSubject
5:",maths
print("MarksinSubject6:",math
sB) print("TotalMarks:",total)
print("Percentage:",round(percentage,2),"%")
print("Grade:",grade)

You might also like