Steps:
- Create a file with .py extension. - Write solution of given problem and save - Run to get the Output
Solution/code: temperature.py filecelsius = float(input("Enter temperature in celsius : ")) fahrenheit = (celsius * 9/5) + 32 print('Entered Celsius is:' ,celsius) print('Celsius to Fahrenheit is:' ,fahrenheit)
OutputEnter 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
Proverbs 8:33
Hear instruction, and be wise, and refuse it not.
0 Comments