I want to all the values to add up but the total value comes out to be none. please help.
def main():
#local variable
number = 0
num_list = []
#user inputs numb3er
number = int(input('Enter number: '))
num_list.append(number)
print_num(number)
print('The total value of the list is: ', sum_list(num_list))
def print_num(n):
num_list = []
if n > 1:
print_num(n - 1)
num_list.append(n)
print(n)
return num_list
def sum_list(num_list):
if not num_list:
return 0
return num_list[0] + sum_list(num_list[1:])
main()
i currently adjusted what was recommended but it still doesn't sum up the values