Advertisement
svephoto

Everest [Python]

Jul 21st, 2021 (edited)
3,383
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.80 KB | None | 0 0
  1. command = input()
  2. initial_hiking_meters = 5364
  3. the_peak_height = 8848
  4. days_for_hiking = 1
  5.  
  6. while command != "END":
  7.     meters_to_hike = int(input())
  8.  
  9.     if command == "Yes":
  10.         days_for_hiking += 1
  11.         if days_for_hiking > 5:
  12.             print("Failed!")
  13.             print(f"{initial_hiking_meters}")
  14.             break
  15.         initial_hiking_meters += meters_to_hike
  16.     else:
  17.         initial_hiking_meters += meters_to_hike
  18.     if initial_hiking_meters >= the_peak_height:
  19.         print(f"Goal reached for {days_for_hiking} days!")
  20.         break
  21.  
  22.     command = input()
  23.  
  24. if command == "END":
  25.     if initial_hiking_meters >= the_peak_height:
  26.         print(f"Goal reached for {days_for_hiking} days!")
  27.     else:
  28.         print("Failed!")
  29.         print(f"{initial_hiking_meters}")
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement