Advertisement
GeorgiLukanov87

5. Office Chairs List advanced - exercise 100/100

Jul 5th, 2022
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.50 KB | None | 0 0
  1. # 5. Office Chairs List advanced - exercise 100/100
  2.  
  3.  
  4. n = int(input())
  5. free_seats = 0
  6. need_more_seats = False
  7. for num_room in range(1, n+1):
  8.     room = input().split(' ')
  9.     seats = len(room[0])
  10.     people = int(room[1])
  11.     if seats > people:
  12.         free_seats += seats - people
  13.     if seats - people < 0:
  14.         print(f"{abs(seats-people)} more chairs needed in room {num_room}")
  15.         need_more_seats = True
  16.  
  17. if not need_more_seats:
  18.     print(f"Game On, {free_seats} free chairs left")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement