-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTask1.py
More file actions
36 lines (27 loc) · 1.37 KB
/
Task1.py
File metadata and controls
36 lines (27 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
def get_coordinates(flat_number, stages, flat_per_stage):
flats_per_block = stages * flat_per_stage
if flat_number % flats_per_block:
target_block = (flat_number // flats_per_block) + 1
else:
target_block = (flat_number // flats_per_block)
temp_flats = flat_number - int(flat_number // flats_per_block) * flats_per_block
if temp_flats == 0:
return [target_block, stages]
else:
if temp_flats % flat_per_stage:
target_stage = temp_flats // flat_per_stage + 1
else:
target_stage = temp_flats // flat_per_stage
return [target_block, target_stage]
# ----------------------------------
# """Задание 1"""
if __name__ == '__main__':
# flat_number = input("Enter your flat: ")
# stages = input("Enter stages: ")
# flat_per_stage = input("Enter flat on the floor: ")
print(get_coordinates(40, 2, 10))
# ----------------------------------
"""Задача 1. Курьер
Вам известен номер квартиры, этажность дома и количество квартир на этаже. Задача: написать функцию,
которая по заданным параметрам напишет вам, в какой подъезд и на какой этаж подняться, чтобы найти искомую квартиру.
"""