DiYane

Shopping

Jul 2nd, 2023 (edited)
948
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.28 KB | Help | 0 0
  1. budget = int(input())
  2.  
  3. while True:
  4.     line = input()
  5.     if line == "End":
  6.         print("You bought everything needed.")
  7.         break
  8.  
  9.     price = int(line)
  10.  
  11.     if budget >= price:
  12.         budget -= price
  13.     else:
  14.         print("You went in overdraft!")
  15.         break
Advertisement
Add Comment
Please, Sign In to add comment