dilyanyordanov

07. Cinema Tickets

Jun 18th, 2021
888
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. command = input()
  2. percentage_of_cinema_room_fullness = 0
  3. total_count_of_tickets_for_all_movies = 0
  4. student_tickets = 0
  5. standard_tickets = 0
  6. kids_tickets = 0
  7.  
  8.  
  9. while command != "Finish":
  10.     free_seats_in_cinema = int(input())
  11.     percentage_of_cinema_room_fullness = 0
  12.     total_tickets_bought = 0
  13.  
  14.     for i in range(0, free_seats_in_cinema):
  15.         type_of_ticket = input()
  16.         if type_of_ticket == "End" or type_of_ticket == "Finish":
  17.             break
  18.         if type_of_ticket == "student":
  19.             student_tickets += 1
  20.             total_tickets_bought += 1
  21.         if type_of_ticket == "standard":
  22.             standard_tickets += 1
  23.             total_tickets_bought += 1
  24.         if type_of_ticket == "kid":
  25.             kids_tickets += 1
  26.             total_tickets_bought += 1
  27.  
  28.         total_count_of_tickets_for_all_movies += 1
  29.         percentage_of_cinema_room_fullness = (total_tickets_bought / free_seats_in_cinema) * 100
  30.     print(f"{command} - {percentage_of_cinema_room_fullness:.2f}% full.")
  31.  
  32.     command = input()
  33.  
  34. percentage_student_tickets = (student_tickets / total_count_of_tickets_for_all_movies) * 100
  35. percentage_standard_tickets = (standard_tickets / total_count_of_tickets_for_all_movies) * 100
  36. percentage_kids_tickets = (kids_tickets / total_count_of_tickets_for_all_movies) * 100
  37. print(f"Total tickets: {total_count_of_tickets_for_all_movies}")
  38. print(f"{percentage_student_tickets:.2f}% student tickets.")
  39. print(f"{percentage_standard_tickets:.2f}% standard tickets.")
  40. print(f"{percentage_kids_tickets:.2f}% kids tickets.")
  41.  
RAW Paste Data