Python Python Basics All Together Now Branch and Loop

Hey there my code keep looping even after printing out (SOLD and remaining tickets )?

Fro some reason even after its prints out SOLD and remaining tickets its keep looping all over again like "Name input". I think my indentation is wrong.


tickets_remaining = 100

while tickets_remaining:

print("There are {} tickets ramaining.".format(tickets_remaining))
name = input("What is your name: ")
num_tickets = input("How many tickets would you like , {}? ".format(name))
num_tickets = int(num_tickets)
amount_due = num_tickets * TICKET_PRICE
print("Total due is ${}".format(amount_due))

proceed = input("Would you like to proceed, Y/N {}?".format(name))
if proceed == "Y" or "y":
  tickets_remaining -= num_tickets
  print("Thank you anyways {}!".format(name))

print("Sorry the tickets sold out!!!")

While loops lack of condition: while tickets_remaining >= 1:

You should add a condition to the while loop

#Run this code until we run out of tickets
while tickets_remaining >= 1:

Although you are looking at it being true being more expanding on that will be better for the future.

1 Answer