BbJLeB

04. Walking

May 15th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.47 KB | None | 0 0
  1. # 04. Walking
  2.  
  3. steps = 0
  4. goal = 10000
  5.  
  6.  
  7. while steps < goal:
  8.     command = input()
  9.     if not command == "Going home":
  10.         steps += int(command)
  11.     else:
  12.         extra_steps = int(input())
  13.         steps += extra_steps
  14.         if steps >= goal:
  15.             print(f"Goal reached! Good job!")
  16.         else:
  17.             print(f"{goal - steps} more steps to reach goal.")
  18.         break
  19.  
  20.     if steps >= goal:
  21.         print(f"Goal reached! Good job!")
Add Comment
Please, Sign In to add comment