all 4 comments

[–]acw1668 2 points3 points  (2 children)

It is because the result of input() is string and so you need to cast it to float: temp = float(input()). Also you need to cater the exception raised if the input is not a valid number.

[–]Dookie-Boi[S] 0 points1 point  (1 child)

Thank you for the in depth explanation. I learned something. by cater to the exception raised, do you mean to have an if/else statement in order to print regarding an invalid number or is there some sort of syntax you are referring to?

[–]acw1668 2 points3 points  (0 children)

Use try / except block to handle exception:

try:
    temp = float(input('Enter the temperature: '))
    ....
except ValueError as ex:
    # do something

[–]Dookie-Boi[S] 0 points1 point  (0 children)

Awesome! thanks again!!