I am trying to make a program that will ask the user to input 25 integers.
This is where I'm at now:
while True:
numbers = list(map(int, input("Enter 25 numbers (seperate it with space): ").split()))
I am trying to make a program that will ask the user to input 25 integers.
This is where I'm at now:
while True:
numbers = list(map(int, input("Enter 25 numbers (seperate it with space): ").split()))
This should do the trick. It will prompt you with the question again if you do not enter the right amount of characters. Plus, it does not count spaces as characters.
gettingInput = True
while gettingInput:
numbers = list(map(int, input("Enter 25 numbers (seperate it with space): ").split()))
if len(numbers) - numbers.count(" ") > 25:
gettingInput = True
else:
gettingInput = False
# (- numbers.count(" ") will not count spaces as characters.)