So I'm making a code that accepts a number with only 8 or 7 digits and then if the user enters an 8 digit number then it should add all 8 digits together then divide by 10 and print out the answer. I have been trying to change the user's input into a list but it hasn't been working out.
My current code (not working):
NumGiven=''
while not NumGiven.isnumeric():
NumGiven=(input('Please enter a 7 or 8 digit number:'))
while len(NumGiven)<7 or len(NumGiven)>8:
NumGiven=(input('Please enter a 7 or 8 digit number:'))
if len(NumGiven)==8:
list=[int(i) for i in NumGiven.split()]
I think there is something wrong with the last line, I looked at many other topics but they never seemed to work. Can some one help me tweak this code.