• Register
0 votes
137 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 2 views
2 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 11 hours ago Mashhoodch 5.7k points
0 votes
1 answer 13 views
13 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 5.7k points
1 vote
1 answer 44 views
44 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
2 answers 1.7K views
1.7K 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 9 views
9 views
Problem: Hi there! I just recently learned loops in Python that are a bit complex and tricky. I got an assignment from my teacher in which I have to write a program that takes a number as input from the user and prints the multiplication table of that number. I tried ... that the user does not enter a negative number. I do not know what the problem is and how to resolve it. Any help? Thanks.
asked Dec 2, 2020 Code Learner 5.5k points
0 votes
1 answer 22 views
22 views
Problem: What is the purpose of __ init __? Is __ init __ necessary in Python? What does __ init __ return? Whenever object oriented programming is done in Python, we mostly come across __init__ method which we usually don’t fully understand. This article explains the main concept of __init__ but before understanding the __init__ some prerequisites are required.
asked Jan 6 Mashhoodch 5.7k points
0 votes
1 answer 15 views
15 views asked Oct 24, 2020 Shaad Sh 800 points
0 votes
1 answer 55 views
55 views
I was working on that. I just want to know how to do that?
asked Nov 5, 2020 TeamScript 9.5k points
0 votes
1 answer 129 views
129 views
Problem: I am a naïve to programming in C language. Please find below some relevant part of my code. I do not see any issues in my below code but still I keep on receiving below error: “Invalid operands to binary expression ('double' and 'double').” Please find ... is a double???? } printf ("%d\n", rem);          I need the modulo at any condition  but it is not working return 0;
asked Aug 13, 2020 Raphael Pacheco 4.9k points
0 votes
1 answer 60 views
60 views
Problem: I am running into this error for multiple variables, even handling missing values. For example: le = preprocessing.LabelEncoder() categorical = list(df.select_dtypes(include=['object']).columns.values) for cat in categorical: print(cat) df[cat].fillna('UNK', inplace=True) ... error results in: df['CRM do Médico'].isnull().sum() 0 Apart from nan values, what could be causing this error?
asked Dec 24, 2020 sasha 5.3k points