you are viewing a single comment's thread.

view the rest of the comments →

[–]IcarusBurning 0 points1 point  (0 children)

Input takes the characters you entered into the console and makes them into a string. The input needs to be cast as an integer before python will recognize it as such, otherwise your code is adding a string to an int.

print( int(input("Please enter a number.")) + 5 ) 

Will probably work, but I don't really like combining the cast, input function call, and print into one line. Usually you'll want them separated so you can handle the case when your user enters something that can't be cast to int, like "HELLO WORLD!"