#python assingment help - song loop

1 messages · Page 1 of 1 (latest)

old valley
#

hey guys, i need help with an assingment. I have to make a song loop but i don’t know why it’s showing me an error
here’s what i have so far;

#

do i need a variable?

wintry laurel
#

You need a condition

#

Ex.

continue = True

while continue == True:
    # do something 

Thus will make the loop continue ubtile the variable continue becomes False.

In Python you can simplify those a bit by doing this

while continue:
   # do something
old valley
#

i think i did. something wrong 🙁

#

i need it to count down ☹️

#

this is an example >>>>

wintry laurel
#

One solution is to change the condition to bottles > 0 and decrement the number of bottles.

#

;compile

bottles = 5

while bottles > 0:
    print(f"{bottles} bottles") 
    bottles -= 1