Advertisement
Kaloyankerr

Cinema Tickets-Forum

Jun 14th, 2020
4,424
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.98 KB | None | 0 0
  1. movie = input()
  2. total_tickets = 0
  3. standard_tickets = 0
  4. student_tickets = 0
  5. kid_tickets = 0
  6.  
  7. while movie != 'Finish':
  8.     free_seats = int(input())
  9.     busy_seats = 0
  10.  
  11.     for i in range(free_seats):
  12.         ticket = input()
  13.  
  14.         if ticket == 'kid':
  15.             kid_tickets += 1
  16.         elif ticket == 'student':
  17.             student_tickets += 1
  18.         elif ticket == 'standard':
  19.             standard_tickets += 1
  20.         elif ticket == 'End':
  21.             break
  22.         total_tickets += 1
  23.         busy_seats += 1
  24.  
  25.     percent_room = (busy_seats / free_seats) * 100
  26.     total_tickets = standard_tickets + student_tickets + kid_tickets
  27.     print(f'{movie} - {percent_room:.2f}% full.')
  28.  
  29.     movie = input()
  30.  
  31.  
  32. print(f'Total tickets: {total_tickets}')
  33. print(f'{(student_tickets / total_tickets) * 100:.2f}% student tickets.')
  34. print(f'{(standard_tickets / total_tickets) * 100:.2f}% standard tickets.')
  35. print(f'{(kid_tickets / total_tickets) * 100:.2f}% kids tickets.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement