Advertisement
Nenogzar

the lift

Feb 20th, 2024
914
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.66 KB | None | 0 0
  1. people = int(input())
  2. lift = list(map(int, input().split()))
  3.  
  4. for wagon, spaces in enumerate(lift):
  5.     if spaces < 4:
  6.         available = 4 - spaces
  7.         if people - available >= 0:
  8.             people -= available
  9.             lift[wagon] += available
  10.         else:
  11.             lift[wagon] += people
  12.             people -= people
  13.  
  14. not_balance = True
  15.  
  16. for count in range(len(lift)):
  17.     if lift[count] < 4:
  18.         not_balance = False
  19.  
  20. if not_balance and people == 0:
  21.     print(*lift)
  22. elif people == 0:
  23.     print('The lift has empty spots!')
  24.     print(*lift)
  25. else:
  26.     print(f"There isn't enough space! {people} people in a queue!")
  27.     print(*lift)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement