Sichanov

cinema tickets

Apr 16th, 2021
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.00 KB | None | 0 0
  1. name = input()
  2. ticket_kid = 0
  3. ticket_standard = 0
  4. ticket_student = 0
  5. total = 0
  6. type_of_ticket = ''
  7.  
  8. while name != "Finish":
  9.     free_seeds = int(input())
  10.     type_of_ticket = input()
  11.     tickets_per_movie = 0
  12.      
  13.     while type_of_ticket != "End":
  14.         tickets_per_movie += 1
  15.         if type_of_ticket == 'kid':
  16.             ticket_kid += 1
  17.         elif type_of_ticket == 'standard':
  18.             ticket_standard += 1
  19.         elif type_of_ticket == 'student':
  20.             ticket_student += 1
  21.         if tickets_per_movie == free_seeds:
  22.             break
  23.         type_of_ticket = input()
  24.              
  25.     total = ticket_kid + ticket_student + ticket_standard
  26.     print(f"{name} - {tickets_per_movie / free_seeds * 100:.2f}% full.")
  27.     name = input()
  28. else:
  29.     print(f"Total tickets: {total}")
  30.     print(f"{ticket_student / total * 100:.2f}% student tickets.")
  31.     print(f"{ticket_standard / total * 100:.2f}% standard tickets.")
  32.     print(f"{ticket_kid / total * 100:.2f}% kids tickets.")
  33.  
Advertisement
Add Comment
Please, Sign In to add comment