Advertisement
desislava_topuzakova

06. Building

May 15th, 2021
1,083
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.78 KB | None | 0 0
  1. # всички етажи от последния към първия -> [count_floors, 1]
  2. # на всеки етаж обхождам всички стаи -> [0, count_rooms)
  3. count_floors = int(input())
  4. count_rooms = int(input())
  5.  
  6. for floor in range(count_floors, 0, -1):
  7.     for room in range(0, count_rooms):
  8.         # тип на стаята зависи от етажа -> последен L, четен O, нечетен A
  9.         # {буква}{етаж}{стая} {буква}{етаж}{стая}
  10.         if floor == count_floors: # последен
  11.             print(f"L{floor}{room} ", end="")
  12.         elif floor % 2 == 0: # четен
  13.             print(f"O{floor}{room} ", end="")
  14.         else: # нечетен
  15.             print(f"A{floor}{room} ", end="")
  16.     print()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement