Spocoman

05. Travelling

Dec 30th, 2021 (edited)
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.51 KB | None | 0 0
  1. while True:
  2.     destination = input()
  3.     if destination == 'End':
  4.         break
  5.     budget = float(input())
  6.     total = 0
  7.     while destination != 'End':
  8.         total += float(input())
  9.         if total >= budget:
  10.             print(f'Going to {destination}!')
  11.             break
  12.  
  13. ИЛИ:
  14.  
  15. while True:
  16.     destination = input()
  17.     if destination == 'End':
  18.         break
  19.     budget = float(input())
  20.     while budget > 0:
  21.         budget -= float(input())        
  22.     print(f'Going to {destination}!')
  23.  
Add Comment
Please, Sign In to add comment