TypeError: '>' not supported between instances of 'NoneType' and 'int'
I'm trying to have written this code with the decorator that has to show these multiples (which are of 3 and 5) and their sum by typing a number of maximum range. Here is it: def multi(max_case): def three_and_five(): n = max_case() sum = 0 while n > 1: if n%3==0 or n%5==0: sum+=n print(n) elif n%3==0 and n%5==0: sum+=n print(n) n-=1 print('\n'+str(sum)) return three_and_five @multi def add_value(): n = int(input('Type a natural number: ')) print(n) add_value() Unfortunately there must be something wrong, because after running that and entering integer value I got this output: Line 5: TypeError: '>' not supported between instances of 'NoneType' and 'int' Does anyone have an idea why it's so and how to solve it?