-2
Traceback (most recent call last):
  File "C:\Users\HP\AppData\Local\Programs\Python\Python37-32\codejam2.py", line 1, in <module>
    n=int(input())
ValueError: invalid literal for int() with base 10: ''

This is the error that I am getting

halfer
  • 19,824
  • 17
  • 99
  • 186
  • 1
    Welcome to Stack overflow, you need to add the code related to the problem. – Shmuel Oct 05 '19 at 21:48
  • 1
    What's your input? – blhsing Oct 05 '19 at 21:49
  • Though I ansered the question. If you had searched in stack overflow for int valueerror and input you would have found as second hit following link https://stackoverflow.com/questions/34236451/no-idea-why-i-am-getting-valueerror-invalid-literal-for-int-with-base10/34238066#34238066 which might have pointed you in the right direction even without posting a question. – gelonida Oct 05 '19 at 22:56
  • Possible duplicate of [ValueError: invalid literal for int() with base 10: ''](https://stackoverflow.com/questions/1841565/valueerror-invalid-literal-for-int-with-base-10) – Alessandro Da Rugna Oct 06 '19 at 06:57

1 Answers1

1

Other people pointed already out, that in order to keep Stack overflow efficient it is important to have all essential information in the question.

Your question is very minimalist and it's normally better to show the surrounding code and to explain what you want to achieve and how the error happened.

However in this particular case all the information for a basic answer is already in the error message.

line 1 reads user input and then tries to convert it to a number.

It seems you just pressed enter, which means the result of input() is an empty string.

An empty string cannot be converted to an integer.

if you had entered "hello" the error message would have been

invalid literal for int() with base 10: 'hello'

So just enter a text that can be converted to a number and your program should run successfully.

If not you might want to look at try / except and write code, that detects if the input cannot be converted and react accordingly (depends on your program to know what is expected)

Shmuel
  • 1,568
  • 10
  • 20
gelonida
  • 5,327
  • 2
  • 23
  • 41