Advertisement
veronikaaa86

06. Cinema Tickets

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