Advertisement
Spocoman

Cinema Voucher

Jan 7th, 2022
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.42 KB | None | 0 0
  1. voucher = int(input())
  2. ticket = 0
  3. other = 0
  4. while True:
  5.     buy = input()
  6.     if buy == "End":
  7.         break
  8.     price = ord(buy[0])
  9.     if len(buy) > 8:
  10.         price += ord(buy[1])
  11.         if voucher >= price:
  12.             ticket += 1
  13.         else:
  14.             break
  15.     else:
  16.         if voucher >= price:
  17.             other += 1
  18.         else:
  19.             break
  20.     voucher -= price
  21.  
  22. print(ticket)
  23. print(other)
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement