Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def sell_tickets():
- total_tickets = 500
- ticket_price = 100
- while total_tickets > 0:
- try:
- requested_tickets = int(input("Enter the number of tickets: "))
- if requested_tickets > total_tickets:
- print(f"Only {total_tickets} tickets available.")
- else:
- total_tickets -= requested_tickets
- total_cost = requested_tickets * ticket_price
- print(f"{requested_tickets} tickets sold. Total cost: {total_cost} manat.")
- except ValueError:
- print("Please enter a valid number.")
- print("All tickets are sold.")
- sell_tickets()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement