Here’s the link to Wikibooks Python tutorial. I was practising the “Combining Numbers and Strings” given on that page. The first code is certain to produce an error (it is written there) but the second code is also producing an error:
print ("Please give me a number:",)
response = raw_input()
number = int(response)
Traceback (most recent call last): File "<pyshell#2>", line 1, in <module>
number = int(response) ValueError: invalid literal for int() with base 10: ''
I can’t seem to find out how to fix it.
I am using Python 3.3.0 and I know it is input() and not raw_input().
Please help.
You are combining a string and an integer.
Is the correct code.