Traceback (most recent call last): File "/piston/jobs/aea0f700-51c4-48f4-b83d-0a1c37ad2b8b/test.py", line 8, in <module> n,m=map(int,input().split())ValueError: invalid literal for int() with base 10: '{{}}'1
Question
Traceback (most recent call last): File "/piston/jobs/aea0f700-51c4-48f4-b83d-0a1c37ad2b8b/test.py", line 8, in <module> n,m=map(int,input().split())ValueError: invalid literal for int() with base 10: '{{}}'1
Solution
The error message you're seeing is a Python ValueError. It's being caused by the line n,m=map(int,input().split()). This line is trying to take an input, split it into parts, convert those parts into integers, and then assign those integers to n and m.
The error message invalid literal for int() with base 10: '{{}}' is saying that the function int() is trying to convert the string '{{}}' into an integer, which it can't do because '{{}}' isn't a valid representation of an integer.
To fix this error, you need to ensure that the input being passed to int() is a string that correctly represents an integer. For example, if your input was '5 10', the split() function would divide this into ['5', '10'], and int() would be able to successfully convert these strings into the integers 5 and 10.
Similar Questions
Traceback (most recent call last): File "/piston/jobs/0b735acd-420a-4c07-ba63-ca0647f9d8e7/test.py", line 16, in <module> n=int(input())ValueError: invalid literal for int() with base 10: '24 2'
Traceback (most recent call last): File "/piston/jobs/b4a38496-5fb5-4161-b994-1c959d5e0c10/test.py", line 3, in <module> a,b=map(int,input().split())ValueError: not enough values to unpack (expected 2, got 1)
Traceback (most recent call last): File "/piston/jobs/523fac8c-c241-4a64-a680-846fde87075d/test.py", line 19, in <module> r=[list(map(int,input().split())) for _ in range(m)] File "/piston/jobs/523fac8c-c241-4a64-a680-846fde87075d/test.py", line 19, in <listcomp> r=[list(map(int,input().split())) for _ in range(m)]EOFError: EOF when reading a line
Traceback (most recent call last): File "/piston/jobs/c51e5b9c-c0fd-4890-a1cf-811f0aaa0b19/test.py", line 18, in <module> row=list(map(int,input().split()))EOFError: EOF when reading a line
Traceback (most recent call last): File "/piston/jobs/22662a3d-72b6-423a-b219-4b778f327c41/test.py", line 14, in <module> c[i[0]-1]=i[1]IndexError: list assignment index out of range
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.