def average(list): if len(list) > 0: return sum(list)/len(list) else: return 0 if __name__ == '__main__': numbers = [1, 2, 3, 4, 5] print('The average of the numbers is:', average(numbers))
© Kevin Maurizi