Advertisement
veronikaaa86

06. Cinema Tickets

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