sum = 0
codeid = input("Please enter your ID code: ")
if len(str(codeid)) == 10:
sum = sum + int(str(codeid) [0]) * 10
sum = sum + int(str(codeid) [1]) * 9
sum = sum + int(str(codeid) [2]) * 8
sum = sum + int(str(codeid) [3]) * 7
sum = sum + int(str(codeid) [4]) * 6
sum = sum + int(str(codeid) [5]) * 5
sum = sum + int(str(codeid) [6]) * 4
sum = sum + int(str(codeid) [7]) * 3
sum = sum + int(str(codeid) [8]) * 2
remainder = sum % 11
if remainder >= 2 and (11 - remainder == int(str(codeid) [9])):
print ("valid ID")
elif remainder < 2 and (remainder == int(str(codeid) [9])):
print ("valid ID")
else :
print ("Invalid ID")
else:
print ("Invalid ID")
So this is a simple code I've created for detecting either a specific type of ID is valid or not. for example the number "0462519449" is valid due to the algorithm and the output returns "valid" when I run the code in VSCode; however, when I save the program and run it from terminal, I get the output "invalid ID" which is not true since it must be valid. Does anyone know what the problem is?