Advertisement
go6odn28

Python-Basics Nested Loops - Lab_6_building

Oct 8th, 2023
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.34 KB | None | 0 0
  1. floors = int(input())
  2. rooms_per_floor = int(input())
  3.  
  4. for floor in range(floors, 0, -1):
  5.  
  6.     if floor % 2 == 0:
  7.         room_type = 'O'
  8.     else:
  9.         room_type = 'A'
  10.  
  11.     if floor == floors:
  12.         room_type = 'L'
  13.  
  14.     for room in range(rooms_per_floor):
  15.         print(f'{room_type}{floor}{room}', end=' ')
  16.  
  17.     print()
  18.    
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement