Dec-23-2016, 05:27 AM
Quote:now how i can loop through the input value?It's soon Christmas ,so this should help

def hm_cars(user_input): income = [] if user_input <= 0: return for number in range(1, user_input+1): income.append(int(input('Income car:{}'.format(number)))) return income user_input = int(input('How many cars do you have? ')) cars = hm_cars(user_input) print(cars) print('Sum of all cars income {}'.format(sum(cars)))