135. Python Program to Convert Celsius to Fahrenheit Using a Function
Easyreturn
Overview
A function that works something out should return it. The main program prints it.
Problem Statement
Write a function to_fahrenheit(celsius) that returns the temperature in Fahrenheit: Celsius times 9, divided by 5, plus 32. The function should not print anything.
Then read a temperature in Celsius (a number, maybe with decimals), call the function, and print both temperatures with one decimal, like this for 25:
25.0 C = 77.0 F
Use input() with no prompt text: the tests type the input for you, and a prompt would end up in your output.
Input
One number. Example:
25
Output
The output for that example:
25.0 C = 77.0 F
The tests try 4 different inputs, including a temperature below zero.