Advertisement
veronikaaa86

04. Walking

Mar 27th, 2022
303
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. input_line = input()
  2. sum_steps = 0
  3. while input_line != "Going home":
  4. steps = int(input_line)
  5. sum_steps += steps
  6.  
  7. if sum_steps >= 10000:
  8. break
  9.  
  10. input_line = input()
  11.  
  12. if input_line == "Going home":
  13. steps_home = int(input())
  14. sum_steps += steps_home
  15.  
  16. diff = abs(sum_steps - 10000)
  17. if sum_steps >= 10000:
  18. print("Goal reached! Good job!")
  19. print(f"{diff} steps over the goal!")
  20. else:
  21. print(f"{diff} more steps to reach goal.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement