l=[int(x) for x in input().split()]
When I run this code,I get this error
ValueError: invalid literal for int() with base 10: ‘undefined’
Please help me
Error while converting string to int
You can solve this invalid literal for int() with base 10 by using Python isdigit() method to check whether the value is number or not. The returns True if all the characters are digits, otherwise False.
num = "55.55"
if num.isdigit():
print(int(num))
else:
print("String value is not a digit : " , num)