Need help | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Need help

How can I complete the iteration seats = 100 seats > 0: print("Sell ticket") = seats - 1

30th Jan 2024, 4:47 PM
Amadou Jallow
Amadou Jallow - avatar
7 Answers
+ 5
seats = 100 while seats > 0: print("Sell ticket") seats = seats - 1 This loop will continue selling tickets as long as there are seats available (seats > 0). Inside the loop, it prints "Sell ticket" and decrements the seats variable by 1 with each iteration. The loop will exit when there are no more seats left.
30th Jan 2024, 6:07 PM
Zahed Shaikh
Zahed Shaikh - avatar
+ 6
Your question seems vague. Whatever you trying to solve there might be more description on what you need to use ? Like if-else, for loop?
30th Jan 2024, 6:06 PM
D Shah 🎯⏳️
D Shah 🎯⏳️ - avatar
+ 6
Your question is more a case of how to START iteration at this stage. I recommend revisiting the lesson in Introduction to Python > Control Flow > While Loops which holds the course notes for your exact question and see if that helps, that lesson explains the solution.
30th Jan 2024, 6:08 PM
StuartH
StuartH - avatar
+ 4
@Zahed Shaikh or for i <= range(100): print("Sell ticket") easy bro
31st Jan 2024, 2:52 PM
Elyor Khaitov
Elyor Khaitov - avatar
+ 2
Seats = 100 While Seats > 0: Print ("Sell ticket") Seats -=1
1st Feb 2024, 9:37 AM
hour 11
hour 11 - avatar
+ 2
seats = 100 while seats > 0: print("Sell ticket") seats -= 1
1st Feb 2024, 1:42 PM
Мухаммадчон Мусаев
Мухаммадчон Мусаев - avatar
+ 1
You Can Loop Like Now this ::::: seats = 100 while seats > 0: print("Sell ticket") seats -= 1
1st Feb 2024, 6:29 AM
Code With Nouman
Code With Nouman - avatar