Advertisement
veronikaaa86

06. Cinema Tickets

Aug 6th, 2023
1,063
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.17 KB | None | 0 0
  1. input_line = input()
  2.  
  3. standard_count = 0
  4. student_count = 0
  5. kid_count = 0
  6. total_count = 0
  7. while input_line != "Finish":
  8.     movie = input_line
  9.     capacity = int(input())
  10.  
  11.     current_tickets_count = 0
  12.     command_line = input()
  13.     while command_line != "End":
  14.         type_ticket = command_line
  15.         current_tickets_count += 1
  16.  
  17.         if type_ticket == "standard":
  18.             standard_count += 1
  19.         elif type_ticket == "student":
  20.             student_count += 1
  21.         elif type_ticket == "kid":
  22.             kid_count += 1
  23.  
  24.         if current_tickets_count == capacity:
  25.             break
  26.  
  27.         command_line = input()
  28.  
  29.     total_count += current_tickets_count
  30.  
  31.     percentage_current = current_tickets_count / capacity * 100
  32.     print(f"{movie} - {percentage_current:.2f}% full.")
  33.  
  34.     input_line = input()
  35.  
  36. print(f"Total tickets: {total_count}")
  37. percent_student = student_count / total_count * 100
  38. print(f"{percent_student:.2f}% student tickets.")
  39. percent_standard = standard_count / total_count * 100
  40. print(f"{percent_standard:.2f}% standard tickets.")
  41. percent_kid = kid_count / total_count * 100
  42. print(f"{percent_kid:.2f}% kids tickets.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement