+ 1

What's wrong here? I need to convert Celsius in Fahrenheit

celsius = int(input()) def conv(c): print(9/5*celsius+32) fahrenheit = conv(celsius) print(fahrenheit)

3rd Feb 2023, 8:49 PM
Ruben Bravo
Ruben Bravo - avatar
2 Respuestas
+ 3
Your function does not return any values which means that when you do: Print(fahrenheit) it returns None. Since your function already prints the result you do not have to print the function. If however your goal is to create the variable fahrenheit with the right value for later usage in the code you can switch the print() in your function with return. It would look like this: celsius = int(input()) def conv(c): return 9/5*celsius+32 fahrenheit = conv(celsius) print(fahrenheit)
3rd Feb 2023, 8:56 PM
HelloWorld
+ 1
Thanks!! Now I get it
3rd Feb 2023, 9:15 PM
Ruben Bravo
Ruben Bravo - avatar