Advertisement
aneliabogeva

Cinema vaucher

May 16th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. vaucher = float(input())
  2. command = input()
  3. price = 0
  4. numberOfTickets = 0
  5. numberOfGoods = 0
  6.  
  7. while command != "End":
  8. if len(command) > 8:
  9. first = ord(command[0])
  10. second = ord(command[1])
  11. price = int(first) + int(second)
  12. if price <= vaucher:
  13. numberOfTickets += 1
  14. else:
  15. break
  16. elif len(command) <= 8:
  17. first = ord(command[0])
  18. price = int(first)
  19. if price <= vaucher:
  20. numberOfGoods += 1
  21. else:
  22. break
  23. vaucher = vaucher - price
  24. command = input()
  25.  
  26. print(f"{numberOfTickets}")
  27. print(f"{numberOfGoods}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement