ALEXANDAR_GEORGIEV

cinema_ticket

May 19th, 2022 (edited)
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.91 KB | None | 0 0
  1. price_ticket = 5
  2. discount = 0
  3. total_discount = 0
  4. in_visitors = 0
  5. house_capacity = int(input())
  6. check_visitors = house_capacity
  7. while True:
  8.     count_visitors = input()
  9.     if count_visitors == "Movie time!":
  10.         break
  11.     num_count_visitors = int(count_visitors)
  12.     in_visitors = in_visitors + num_count_visitors
  13.     check_visitors = check_visitors - num_count_visitors
  14.  
  15.     if not num_count_visitors % 3:
  16.         # discount = 5
  17.         total_discount = total_discount + 5
  18.     if check_visitors < 0:
  19.         check_visitors = 0
  20.         in_visitors = house_capacity
  21.         break
  22. total_revenue = in_visitors * price_ticket - total_discount
  23. if count_visitors == 'Movie time!':
  24.     print(f"There are {check_visitors} seats left in the cinema.")
  25.     print(f"Cinema income - {total_revenue} lv.")
  26. elif check_visitors == 0:
  27.     print(f"The cinema is full.")
  28.     print(f"Cinema income - {total_revenue} lv.")
  29.  
Add Comment
Please, Sign In to add comment