+ 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)
2 Respostas
+ 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)
+ 1
Thanks!! Now I get it