Sichanov

cinema tickets

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