Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- floors = int(input())
- flats_per_floor = int(input())
- for f in range(floors, 0, -1):
- appendix = ""
- if f == floors:
- appendix = "L"
- elif f % 2 == 1:
- appendix = "A"
- else:
- appendix = "O"
- for n in range(flats_per_floor):
- print(f"{appendix}{f}{n}", end=" ")
- print()
- Решение с тернарен оператор:
- floors = int(input())
- flats_per_floor = int(input())
- for f in range(floors, 0, -1):
- appendix = "L" if f == floors else "A" if f % 2 == 1 else "O"
- for n in range(flats_per_floor):
- print(f"{appendix}{f}{n}", end=" ")
- print()
Add Comment
Please, Sign In to add comment