Python Programming - Write a program to convert temperature from Celsius to Fahrenheit. Equation to convert Celsius to Fahrenheit F = (9/5) C + 32.

Write a program to convert temperature from Celsius to Fahrenheit. Equation to convert Celsius to Fahrenheit F = (9/5)  C + 32.

Steps:

- Create a file with .py extension. - Write solution of given problem and save - Run to get the Output

Solution/code: temperature.py file

celsius = float(input("Enter temperature in celsius : ")) fahrenheit = (celsius * 9/5) + 32 print('Entered Celsius is:' ,celsius) print('Celsius to Fahrenheit is:' ,fahrenheit)

Output

Enter temperature in celsius : 34 Entered Celsius is: 34.0 Celsius to Fahrenheit is: 93.2

Explanation:

- print() : used to print a python objects(string, list, tuple, etc.). - Syntax: print(object(s), sep, end, file, flush) - Celsius to Fahrenheit Formula :- Celsius = (Fahrenheit – 32) * 5/9 - Fahrenheit to celsius :- Fahrenheit = (Celsius * 9/5) + 32 - To convert the input to int or float we have to use the int() and float() method

Try Your code Here

# type your code Here print ("Hello Python Learner")

Proverbs 8:33
Hear instruction, and be wise, and refuse it not.

Dose of Motivation

"Improve by 1% a day, and in just 70 days, you're twise as good" - Alan Weiss [ Dear Me ]


Post a Comment

0 Comments