list_day = [31,28,31,30,31,30,31,31,30,31,30,31] month = 0 date = 1 count = 0 def variable(x): if x < 10: var1 = 0 var2 = x else: val1,val2 = str(x) D1 = int(val1) D2 = int(val2) return D1,D2 def happyday(m,y,z): if m == y + z: count += 1 return count while month <= 11: while date <= list_day[month]: variable(date) happyday(month,D1,D2) date = date + 1 month = month + 1 print(count)