Lab 1

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

In 

[1]: # sharan 90, sangu 82


a=int(input("Enter the integer:"))
if a>0:
print("The given number is positive")

Enter the integer:5

The given number is positive

In [2]: # sharan 90, sangu 82


a=int(input("enter the integer:"))
if a>0:
print("the given number is postive")
else:
print("the given number is negative")

enter the integer:-65

the given number is negative

In [15]: # sharan 90, sangu 82


perc=float(input("enter percentage "))
if perc>=75:
print(perc,'%,-Grade is distinction')
elif perc>=50:
print(perc,'%,-Grade is A')
elif perc>=35:
print(perc,'%,-Grade is B')
else:
print(perc,'%,-Grade Fail')

enter percentage 31

31.0 %,-Grade Fail

In [22]: # sharan 90, sangu 82


def print_menu():
print("1.celsius to fahrenheit")
print("2.fahrenheit to celsius")
print("3.Celsius to Kelvin")

def far():
c=float(input("Enter the Celsius value:"))
f=c*(9/5)+32
print("Temperature in Fahrenite:{0:0.2f}\n".format(f))

def cel():
f=float(input("Enter the Fahrenite value:"))
c=(f-32)*(5/9)
print("Temperature in Celsius:{0:0.2f}\n".format(c))

def kel():
c=float(input("Enter the celcius value:"))
k=c+273
print("Temperature in kelvin:{0:0.2f}\n".format(k))
print_menu()
choice=input("Which Conversation would you like")
if (choice=='1'):
far()
elif (choice=='2'):
cel()
elif (choice=='3'):
kel()
else:print("Invalid")

1.celsius to fahrenheit

2.fahrenheit to celsius

3.Celsius to Kelvin

Which Conversation would you like3

Enter the celcius value:33

Temperature in kelvin:306.00

In [ ]: ​

You might also like