run = True
while run:
command = input('Введите команду: ')
if command == 'возраст':
age = int(input('Введите возраст: '))
elif age == 18 and age <= 21:
row_index = 3
elif age >= 22 and age <= 24:
row_index = 4
elif age >= 25 and age <= 29:
row_index = 5
elif age >= 30 and age <= 34:
row_index = 6
elif age >= 35 and age <= 39:
row_index = 7
elif age >= 40 and age <= 49:
row_index = 8
elif age >= 50 and age <= 59:
row_index = 9
elif age >= 60 and age <= 80:
row_index = 10
if command == 'стаж':
exp = int(input('Введите стаж: '))
if exp == 0:
column_index = 2
elif exp == 1:
column_index = 3
elif exp == 2:
column_index = 4
elif exp == 3 or exp == 4:
column_index = 5
elif exp == 5 or exp == 6:
column_index = 6
elif exp >= 7 and exp <=9:
column_index = 7
elif exp >= 10 and exp <= 14:
column_index = 8
elif exp >= 15 and exp <= 60:
column_index = 9
cell = sheet.cell(row_index, column_index)
result = cell.value
print(result)
Теперь при вводе возраста и стажа выводится нужное значение ячейки с коэффициентом.