Advertisement
aneliabogeva

06. Cinema Tickets - Python

Apr 18th, 2019
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. name = input()
  2.  
  3. total_stident = 0
  4. total_kid = 0
  5. total_standard = 0
  6. total_ticket = 0
  7.  
  8. while name != "Finish":
  9. counter_student = 0
  10. counter_standard = 0
  11. counter_kid = 0
  12. total_counter = 0
  13. freeplaces = int(input())
  14. type = input()
  15. while type != "End":
  16. if type == 'student':
  17. counter_student += 1
  18. elif type == 'standard':
  19. counter_standard += 1
  20. elif type == 'kid':
  21. counter_kid += 1
  22. total_counter +=1
  23. if total_counter >= freeplaces:
  24. break
  25. else:
  26. type = input()
  27. capacity = (total_counter / freeplaces) * 100
  28. print(f"{name} - {capacity:.2f}% full.")
  29. total_kid += counter_kid
  30. total_standard += counter_standard
  31. total_stident += counter_student
  32. total_ticket = total_standard + total_stident + total_kid
  33. name = input()
  34. print(f"Total tickets: {total_ticket}")
  35. print(f"{((total_stident /total_ticket)*100):.2f}% student tickets.")
  36. print(f"{((total_standard /total_ticket)*100):.2f}% standard tickets.")
  37. print(f"{((total_kid /total_ticket)*100):.2f}% kids tickets.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement