Sichanov

cinema

May 16th, 2021
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.25 KB | None | 0 0
  1. film_name = input()
  2.  
  3. total_tickets = 0
  4. standard_count = 0
  5. student_count = 0
  6. kid_count = 0
  7. total_standard_count = 0
  8. total_student_count = 0
  9. total_kid_count = 0
  10. is_finished = False
  11.  
  12. while film_name != "Finish":
  13.     capacity = int(input())
  14.     ticket_type = input()
  15.     ticket_count = 0
  16.     while ticket_type != "End":
  17.         ticket_count += 1
  18.         if ticket_type == "standard":
  19.             standard_count += 1
  20.         elif ticket_type == "student":
  21.             student_count += 1
  22.         elif ticket_type == "kid":
  23.             kid_count += 1
  24.         if ticket_count == capacity:
  25.             break
  26.         ticket_type = input()
  27.  
  28.     print(f"{film_name} - {100 * (ticket_count / capacity):.2f}% full.")
  29.  
  30.     total_tickets += ticket_count
  31.     total_standard_count += standard_count
  32.     total_student_count += student_count
  33.     total_kid_count += kid_count
  34.  
  35.     ticket_count = 0
  36.     standard_count = 0
  37.     student_count = 0
  38.     kid_count = 0
  39.     film_name = input()
  40.  
  41. print(f"Total tickets: {total_tickets}")
  42. print(f"{100 * (total_student_count / total_tickets):.2f}% student tickets.")
  43. print(f"{100 * (total_standard_count / total_tickets):.2f}% standard tickets.")
  44. print(f"{100 * (total_kid_count / total_tickets):.2f}% kids tickets.")
  45.  
Advertisement
Add Comment
Please, Sign In to add comment