Advertisement
webbersof

Untitled

Oct 17th, 2021
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.26 KB | None | 0 0
  1. #   Усложняваш си живота, абсолютно излишни са взиманията на дестинация и пари отвън, опитай се да
  2. #   разбереш while True!!!
  3. # destination = input()
  4. # needed_money = float(input())
  5.  
  6. spend_money = 0
  7. is_money_enough = False
  8.  
  9.  
  10. while True:
  11.     destination = input()
  12.     if destination == 'End':
  13.         break
  14.     needed_money = float(input())
  15.  
  16.     #   Абсолютно никъде не намаляваш spend_money...Което означава, че като отиде на екскурзия, не харчи пари
  17.     #   a както знаеш, безплатни екскурзии няма... За това трябва парите да се намалят!
  18.     while needed_money > spend_money:
  19.         money = float(input())
  20.         spend_money += money
  21.         if needed_money <= spend_money:
  22.             is_money_enough = True
  23.             spend_money = 0
  24.             print(f"Going to {destination}!")
  25.             break
  26.  
  27.     #   Тук винаги ще ти гърми, защото все някога ще получиш END, а след него вместо брейк, имаш needed_money...
  28.     # destination = input()
  29.     # needed_money = float(input())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement