I
I
igorloadgame2021-10-26 13:29:21
Python
igorloadgame, 2021-10-26 13:29:21

Why does it show a Traceback error?

Here is an example code:

a = list(map(int, input().split()))
print(a)

Outputs an error to the console:
Traceback (most recent call last):
  File "путь к файлу", line 1, in <module>
    bags = int(input())
ValueError: invalid literal for int() with base 10: '1 2 3'

What to do? Is this a problem with python itself or something else?
I will be very grateful!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alan Gibizov, 2021-10-26
@igorloadgame

There is no line in your code that the error refers to.
bags = int(input())
I recommend making sure that you run exactly the code that you provided. If you are running an IDE like pycharm, you may be running another open module.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question