Advertisement
PowerCell46

Steps Python

Dec 18th, 2022
881
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.63 KB | None | 0 0
  1. goal_steps = 10000
  2. current_steps = str(input())
  3. sum_of_steps = 0
  4.  
  5. while True:
  6.     if current_steps == "Going home":
  7.         current_steps = int(input())
  8.         sum_of_steps += current_steps
  9.         break
  10.     current_steps = int(current_steps)
  11.     sum_of_steps += current_steps
  12.     if sum_of_steps >= goal_steps:
  13.         break
  14.     current_steps = str(input())
  15.  
  16. if sum_of_steps < goal_steps:
  17.     needed_steps = goal_steps - sum_of_steps
  18.     print(f'{needed_steps} more steps to reach goal.')
  19. else:
  20.     bonus_steps = sum_of_steps - goal_steps
  21.     print(f'Goal reached! Good job!')
  22.     print(f'{bonus_steps} steps over the goal!')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement