I want the program to end if I type "stop".
However, an error occurs when str(intNum)=='stop'
. What should I do?
The error:
"ValueError: invalid literal for int() with base 10: 'stop'"
intSum = 0
while 1:
intNum = int(input("Please enter an integer.(If you want to end it, : stop) : "))
intSum = intSum + intNum
if str(intNum)=='stop':
break
print("SUM=",intSum)