DiYane

Walking 4/10

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