Sichanov

cinema tickets

Apr 17th, 2021
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.19 KB | None | 0 0
  1. line = input()
  2. total_tickets = 0
  3. standard_tickets = 0
  4. student_tickets = 0
  5. kid_tickets = 0
  6.  
  7. while line != 'Finish':
  8.     movie_name = line
  9.     free_seats = int(input())
  10.  
  11.     sold_tickets_per_movie = 0
  12.  
  13.     command = input()
  14.     while command != 'End':
  15.         ticket_type = command
  16.         total_tickets += 1
  17.         sold_tickets_per_movie += 1
  18.  
  19.         if ticket_type == 'standard':
  20.             standard_tickets += 1
  21.         elif ticket_type == 'student':
  22.             student_tickets += 1
  23.         else:
  24.             kid_tickets += 1
  25.  
  26.         if sold_tickets_per_movie == free_seats:
  27.             break
  28.         command = input()
  29.  
  30.     percent_theater_seats = sold_tickets_per_movie / free_seats * 100
  31.     print(f'{movie_name} - {percent_theater_seats:.2f}% full.')
  32.     line = input()
  33.  
  34. print(f'Total tickets: {total_tickets}')
  35.  
  36. percent_student_tickets = student_tickets / total_tickets * 100
  37. print(f'{percent_student_tickets:.2f}% student tickets.')
  38. percent_standard_tickets = standard_tickets / total_tickets * 100
  39. print(f'{percent_standard_tickets:.2f}% standard tickets.')
  40. percent_kid_tickets = kid_tickets / total_tickets * 100
  41. print(f'{percent_kid_tickets:.2f}% kids tickets.')
  42.  
  43.  
Advertisement
Add Comment
Please, Sign In to add comment