Advertisement
veronikaaa86

04. Walking - v.02

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