Advertisement
simeonshopov

Cinema tickets

Oct 22nd, 2019
283
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.79 KB | None | 0 0
  1. film = input()
  2. standard = 0
  3. kid = 0
  4. student = 0
  5. tickets_total = 0
  6.  
  7. while film != "Finish":
  8.   seats = int(input())
  9.   tickets_sold = 0
  10.   for i in range(seats):
  11.     ticket = input()
  12.     if ticket == "End":
  13.       break
  14.     tickets_sold += 1
  15.     if ticket == "standard":
  16.       standard += 1
  17.     elif ticket == "student":
  18.       student += 1
  19.     elif ticket == "kid":
  20.       kid += 1
  21.   print(f"{film} - {((tickets_sold / seats) * 100):.2f}% full.")
  22.   tickets_total += tickets_sold
  23.   film = input()
  24.   if film == "Finish":
  25.     print(f"Total tickets: {tickets_total}")
  26.     print(f"{((student / tickets_total) * 100):.2f}% student tickets.")
  27.     print(f"{((standard / tickets_total) * 100):.2f}% standard tickets.")
  28.     print(f"{((kid / tickets_total) * 100):.2f}% kids tickets.")
  29.     break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement