Teo10

Untitled

Sep 1st, 2019
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.16 KB | None | 0 0
  1.  
  2. total_tickets = 0
  3. student = 0
  4. standard = 0
  5. kid = 0
  6. percentage_students = 0
  7. percentage_standard = 0
  8. percentage_kid = 0
  9.  
  10. while True:
  11.     movie_name = input()
  12.     free_seats = int(input())
  13.  
  14.     for ticket in range(0, free_seats + 1):
  15.         ticket_type = input()
  16.         if ticket_type == "student":
  17.             student += 1
  18.         elif ticket_type == "standard":
  19.             standard += 1
  20.         elif ticket_type == "kid":
  21.             kid += 1
  22.         elif ticket_type == "End":
  23.             break
  24.         elif ticket_type == "Finish":
  25.             break
  26.  
  27.     percentage_busy = (ticket / free_seats) * 100
  28.     print(f"{movie_name} - {percentage_busy:.2f}% full.")
  29.     if ticket_type == "Finish":
  30.         total_tickets = standard + student + kid
  31.         percentage_students = (student / total_tickets) * 100
  32.         percentage_standard = (standard / total_tickets) * 100
  33.         percentage_kid = (kid / total_tickets) * 100
  34.         print(f"Total tickets: {total_tickets}")
  35.         print(f"{percentage_students:.2f}% student tickets.")
  36.         print(f"{percentage_standard:.2f}% standard tickets.")
  37.         print(f"{percentage_kid:.2f}% kids tickets.")
Add Comment
Please, Sign In to add comment