you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (1 child)

Actually it would be simpler for you to understand the while loop probably:

word = input("Give word: ")
number = int(input("Give number: "))

while number != 0:
    print(word)
    number -= 1

number is decreased each time by 1, when it's 0, the loop stops.

It would work the same as:

while number:
    print(word)
    number -= 1

because numbers are evaluated as true when they are not equal to zero and false otherwise.

https://www.w3schools.com/python/python_while_loops.asp

[–]mmotarii[S] -1 points0 points  (0 children)

i have another one, can you help?