Advertisement
mark79

Cinema Tickets

Sep 1st, 2019
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.10 KB | None | 0 0
  1. total_ticket_count = 0
  2. student_ticket_count = 0
  3. standard_ticket_count = 0
  4. kid_ticket_count = 0
  5.  
  6. line = input()
  7. while line != "Finish":
  8.     free_seats = int(input())
  9.     current_ticket_count = 0
  10.  
  11.     input_current_ticket = input()
  12.     while input_current_ticket != "End":
  13.         current_ticket_count += 1
  14.         if input_current_ticket == "student":
  15.             student_ticket_count += 1
  16.         elif input_current_ticket == "standard":
  17.             standard_ticket_count += 1
  18.         elif input_current_ticket == "kid":
  19.             kid_ticket_count += 1
  20.  
  21.         if current_ticket_count == free_seats:
  22.             break
  23.         input_current_ticket = input()
  24.  
  25.     print(f"{line} - {(current_ticket_count / free_seats * 100):.2f}% full.")
  26.     total_ticket_count += current_ticket_count
  27.  
  28.     line = input()
  29.  
  30. print(f"Total tickets: {total_ticket_count}")
  31. print(f"{student_ticket_count / total_ticket_count * 100 :.2f}% student tickets.")
  32. print(f"{standard_ticket_count / total_ticket_count * 100 :.2f}% standard tickets.")
  33. print(f"{kid_ticket_count / total_ticket_count * 100:.2f}% kids tickets.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement