BdW44222

05. Office Chairs

Jun 19th, 2021
935
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def chair_program(rooms_number):
  2.     free_chairs = ""
  3.     needed_chairs = []
  4.     for room in range(rooms_number):
  5.         each_room = input().split()
  6.         chairs = each_room[0]
  7.         people = int(each_room[1])
  8.  
  9.         for chair in range(len(chairs)):
  10.             remaining_chairs = len(chairs) - people
  11.             if remaining_chairs > 0:
  12.                 free_chairs = str(remaining_chairs)
  13.                 return "Game On, " + free_chairs + " free chairs left."
  14.             else:
  15.                 needed_chairs.append(remaining_chairs)
  16.                 if remaining_chairs < 0:
  17.                     needed = str(remaining_chairs * 1)
  18.                     return needed + ' more chairs needed in room ' + chairs[chair]
  19.  
  20.  
  21. rooms_number_input = int(input())
RAW Paste Data