Sichanov

everest

Aug 16th, 2021
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.61 KB | None | 0 0
  1. command = input()
  2. count_days = 1
  3. climbed_meters = 5364
  4. is_failed = False
  5.  
  6. while command != "END":
  7.     sleep = command
  8.     meters_per_day = int(input())
  9.     if sleep == "Yes":
  10.         count_days += 1
  11.         if count_days <= 5:
  12.             climbed_meters += meters_per_day
  13.         else:
  14.             is_failed = True
  15.             break
  16.     elif sleep == "No":
  17.         climbed_meters += meters_per_day
  18.     if climbed_meters >= 8848:
  19.         break
  20.     command = input()
  21.  
  22. if command == "END" or is_failed:
  23.     print("Failed!")
  24.     print(climbed_meters)
  25. else:
  26.     print(f"Goal reached for {count_days} days!")
Advertisement
Add Comment
Please, Sign In to add comment