Teo_Yanchev

cinema_tickets_while

Jul 13th, 2020
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. command = input()
  2.  
  3. students = 0
  4. standard = 0
  5. kids = 0
  6. total_tickets = 0
  7.  
  8. while command != "Finish":
  9. movie = command
  10. free_seats = int(input())
  11. count_seats = 0
  12.  
  13. while free_seats > count_seats:
  14. ticket_type = input()
  15. if ticket_type == "End":
  16. break
  17. total_tickets += 1
  18. count_seats += 1
  19. if ticket_type == "standard":
  20. standard += 1
  21. elif ticket_type == "student":
  22. students += 1
  23. elif ticket_type == "kid":
  24. kids += 1
  25. percent_movie = count_seats / free_seats * 100
  26. print(f"{movie} - {percent_movie:.2f}% full.")
  27.  
  28. command = input()
  29. print(f"Total tickets: {total_tickets}")
  30. print(f"{students / total_tickets * 100:.2f}% student tickets.")
  31. print(f"{standard / total_tickets * 100:.2f}% standard tickets.")
  32. print(f"{kids / total_tickets * 100:.2f}% kids tickets.")
Advertisement
Add Comment
Please, Sign In to add comment