Advertisement
desislava_topuzakova

04. Walking

May 19th, 2020
1,146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.73 KB | None | 0 0
  1. #команда -> Going home или стъпки(текст)
  2. #стоп -> count_steps >= 10000
  3. #продължавам -> count_steps < 10000
  4.  
  5. count_steps = 0
  6. while count_steps < 10000:
  7.     command = input()
  8.     #1. Going home
  9.     if command == 'Going home':
  10.         steps_to_home = int(input())
  11.         count_steps += steps_to_home
  12.         break
  13.     # 2. стъпки под формата на текст
  14.     else:
  15.         walked_steps = int(command)
  16.         count_steps += walked_steps
  17. #спряли вървенето
  18. if count_steps >= 10000:
  19.     #постига целта
  20.     print('Goal reached! Good job!')
  21. else:
  22.     # не си постига целта
  23.     print(f'{10000 - count_steps} more steps to reach goal.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement