vendredi 20 novembre 2020

checking if my input is empty to not take any more values to my list, however I'm struggling to make the check

I trying to take values for my list "age" as long as integers are being inputted. The user is to put a blank line if there are no other inputs left to take. I am trying to write a condition for is the input is empty, to break the while loop.

my code:

count = int(0);
age = [input("please enter your age")];
while True:
if age:
    age.append((input("please enter your age")));
else:
    break;
print(age)

thank you!

Aucun commentaire:

Enregistrer un commentaire