"Cai Gengyang" wrote in message
news:c704cb09-ce62-4d83-ba72-c02583580...@googlegroups.com...
How to debug this error message ?
print('You will be ' + str(int(myAge) + 1) + ' in a year.')
Traceback (most recent call last):
File "<pyshell#53>", line 1, in <module>
print('You will be ' + str(int(myAge) + 1) + ' in a year.')
ValueError: invalid literal for int() with base 10: ''
Very easily :-)
The traceback is telling you everything you need to know.
You are supplying an invalid literal for int().
There is only one place where you call int() - int(myAge) - so myAge must be
an invalid literal.
You could print it out and see what it is, but the traceback is already
giving you that information for free.
Can you see the '' at the end of the message. That is the contents of the
invalid literal.
HTH
Frank Millman
--
https://mail.python.org/mailman/listinfo/python-list