celsius = input("Please enter degrees in celcius: ")
fahrenheit = 0
def f_conversion(celsius):
((celsius * 1.8) + 32 == fahrenheit)
print("Your temp in fahrenheit is: " + str(fahrenheit))
Any clues on to why this isnt working out?
>Solution :
First, there is no need to initialize variables in python. So setting fahrenheit to zero right away is unnecessary.
Second, in the function itself, you are making an equality call. == checks for equality while = sets variable values. Moreover, you are doing so backwards, fahrenheit would be on the left and assigned with = the result of the conversion.
Your script might instead look something like this:
celsius = float(input("Please enter degrees in celcius: "))
def conversion(celsius):
return ((celsius * 9/5) +32)
result = conversion(celsius)
print (f"Your temp in fahrenheit is {result}")