aneliabogeva

Building budget

Aug 16th, 2019
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. budget = float(input())
  2. capital = float(input())
  3. number_investors = int(input())
  4.  
  5. counter = 1
  6.  
  7. while counter <= number_investors:
  8. investor_sum = float(input())
  9. print(f"Investor {counter} gave us {investor_sum:.2f}.")
  10. capital = capital + investor_sum
  11. if capital >= budget:
  12. extra_money = capital - budget
  13. print(f"We will manage to build it. Start now! Extra money - {extra_money:.2f}.")
  14. exit(0)
  15. else:
  16. counter += 1
  17.  
  18. extra_money = budget - capital
  19. print(f"Project can not start. We need {extra_money:.2f} more.")
Advertisement
Add Comment
Please, Sign In to add comment