I'm having difficulty making this simple if statement work. I'm trying to get a string to print for a set amount of times using an 'if' statement
x = 0
if x < 9:
print "this works"
x = x + 1
else:
print "this doesn't work"
The result of the code above is that it prints "this works" only once. I want 1 to be added to x until x reaches 9 and the statement is not longer true.
Can anyone help me here?
Aucun commentaire:
Enregistrer un commentaire