• Register
0 votes
190 views

Problem :

Every time I submitted Python  code, I got

"invalid literal for int() with base 10:"

6 5 3
6,930 points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

The error is "invalid literal for int() with base 10:". This means that the argument that you passed to int doesn't look like a number. In other words it's either empty, or has a char in it other than a digit.

This can be reproduced in a python shell.

>>> int("x")
ValueError: invalid literal for int() with base 10: 'x'
9 7 4
38,600 points

Related questions

0 votes
1 answer 22 views
22 views
Problem: I am creating a program that reads a file and if the first line of the file is not blank, it reads the next four lines. Calculations are performed on those lines and then the next line is read. If that line is not empty it continues. However, I am getting this error: ... with base 10: ''. It is reading the first line but can't convert it to an integer. What can I do to fix this problem?
asked Jan 21 Mashhoodch 13k points
0 votes
1 answer 35 views
35 views
Problem: I am creating a program that reads a file and if the first line of the file is not blank, it reads the next four lines. Calculations are performed on those lines and then the next line is read. If that line is not empty it continues. However, I am getting this error: ... with base 10: ''. It is reading the first line but can't convert it to an integer. What can I do to fix this problem?
asked Jan 9 Mashhoodch 13k points
1 vote
1 answer 3 views
3 views
Problem: I need a help , How I can fix this : python invalid literal for int() with base 10
asked Mar 20 MUHAMMAD MUNEEB 83k points
1 vote
1 answer 11 views
11 views
Problem: Can someone please help fix this : valueerror: invalid literal for int() with base 10: ''
asked Mar 13 MUHAMMAD MUNEEB 83k points
0 votes
1 answer 25 views
25 views
Problem: I am typing to get a sale amount (by input) to be multiplied by a defined sales tax (0.08) and then have it print the total amount (sales tax times sale amount). I run into this error. Anyone know what could be wrong or have any suggestions?
asked Feb 14 Mashhoodch 13k points
0 votes
1 answer 5 views
5 views
Problem: I tried to find out the solution on the web when I face this problem but I did not get any fruitful information that I can continue if you read the above question and understand what is the solution of this please cooperate with me- Thanks
asked Mar 23 rubelkhan 20.4k points
0 votes
2 answers 2.5K views
2.5K views
Problem : While I am running the python code on windows with python 3.5 64 bit. Getting below error. overflowerror: python int too large to convert to c long
asked Oct 22, 2019 peterlaw 6.9k points
0 votes
1 answer 1 view
1 view
Problem I am trying out this code but I keep running into a problem. What exactly is “invalid syntax” and why do I keep getting it in Python?
asked Apr 9 neeraj 10.5k points
1 vote
1 answer 65 views
65 views
Problem: In Python while practising the few question from c language i tried to implement the few of the program but most of the time it come up with the syntax error or the intend error can you help what actually i am missing the syntax error in python every time i execute it.
asked Jun 3, 2020 Gavin 15.3k points
0 votes
1 answer 3 views
3 views
Problem I want to write a c++ source code which convert a string value to long long int
asked Apr 5 Subhendu 4.5k points