On 2023-05-25 22:30, Kevin M. Wilson via Python-list wrote:
Ok, I'm not finding any info. on the int() for converting a str to an int (that specifies 
a base parameter)?! The picture is of the code I've written... And the base 10 paradigm 
involved?? years = int('y') # store for calculationValueError: invalid literal for int() 
with base 10: 'y'What is meant by "invalid literal"? I'm trying to convert srt 
to int, and I didn't know I needed to specify the base. Plus I haven't read anything that 
I need to specify the base for the int().

'12' is a string that contains 2 digits, which together represent the number 12. 'y' is a string that contains a letter, which doesn't represent a number.

Perhaps what you meant is that y is a variable that contains a string, in which case what you want is int(y).

Attached is the code, showing the code and the execution of said code.

There's no code attached; this list automatically strips attachmentments.

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to