def pay(): # количество лет выплаты дивов за 7 последних лет. Если выплата не равно 0, то прибавляем +1
i = 0
if year2019.value != 0:
i += 1
else:
pass
if year2018.value != 0:
i += 1
else:
pass
if year2017.value != 0:
i += 1
else:
pass
if year2016.value != 0:
i += 1
else:
pass
if year2015.value != 0:
i += 1
else:
pass
if year2014.value != 0:
i += 1
else:
pass
if year2013.value != 0:
i += 1
else:
pass
pay_index = i # получаем pay_index
return pay_index
pay()
years = [year2013, year2014, year2015, year2016, year2017, year2018, year2019]
result = sum(y.value for y in years if y.value)
result = sum(y.value for y in years)