1.Temperature converter
BeginnerWrite a function to_fahrenheit(celsius) that returns the temperature in Fahrenheit. Print the result for 0, 37 and 100.
Show hint
The formula is celsius * 9 / 5 + 32. Remember to return the value.
Show solution
def to_fahrenheit(celsius):
return celsius * 9 / 5 + 32
for c in [0, 37, 100]:
print(c, "->", to_fahrenheit(c))0 -> 32.0
37 -> 98.6
100 -> 212.0