veronikaaa86

04. Walking

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