Skip to main content

Welcome to Coding 4 Programming

Addition of Two Binary Numbers | Function | Python

Temperature Convertor | Temperature Calculator | Function | User Friendly | Python

 

Python Program or Project to Convert Temperature (Temperature Conversion's Calculator) from one Unit to another, through Function, completely user Friendly without any type of Errors. 

  • Coding for the above Program.

    1. def temp():
    2.     print("1. Fahrenheit")
    3.     print("2. Celsius")
    4.     print("3. Kelvin")
    5.     c=int(input("Enter Your Choice="))
    6.     if(c>=1 and c<=3):
    7.         return c
    8.     else:
    9.         print("Wrong Input.")
    10.         print("Thankyou for Choosing Coding 4 Programming")
    11.         exit()
    12. def conv(f, t, n):
    13.     if f==1:
    14.         if t==2:
    15.             return (n - 32) * 5/9 
    16.         else:
    17.             return ((n - 32) * 5/9 + 273.15)
    18.     elif f==2:
    19.         if t==1:
    20.             return (n * 9/5) + 32
    21.         else:
    22.             return n + 273.15
    23.     else:
    24.         if t==1:    
    25.             return (n - 273.15) * 9/5 + 32
    26.         else:
    27.             return n - 273.15
    28. print("welcome to Coding 4 Programming")
    29. print("coding4programming.blogspot.com")
    30. print("Temperature Conversion")
    31. print("You want to Convert Temperature from:")
    32. f=temp()
    33. print("You want to Convert Temperature to:")
    34. t=temp()
    35. n=float(input("Enter Value to Convert="))
    36. if f == t:
    37.     print("Required Value is",n)
    38. else:
    39.     m=conv(f, t, n)
    40.     print("Required Value is",m)
    41. print("Thankyou for Choosing Coding 4 Programming")
  • Output of the Temperature Conversion Program.

    Temperature Converter Calculator
    Temperature Convertor Calculator


    Notes:

    • If you have any problem related to this program. Please do comment your Problem or Mail us.
    • For illustrating the any concept you can comment by line number.
    • Thank you! For more programs do regular visit to Coding 4 Programming.

    Comments

    Popular Posts