Advertisement
Guest User

Untitled

a guest
Dec 11th, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.39 KB | None | 0 0
  1. budget = int(input())
  2.  
  3.  
  4. total = 0
  5. command = input()
  6. while command != "Stop":
  7.  
  8.     total = 0
  9.     for letter in command:
  10.         total += ord(letter)
  11.  
  12.     if budget >= total:
  13.         budget -= total
  14.         print(f"Item successfully purchased!")
  15.     else:
  16.         print(f"Not enough money!")
  17.         break
  18.  
  19.     command = input()
  20. if command == "Stop":
  21.     print(f"Money left: {budget}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement