└── calculate sum and average of three numbers /calculate sum and average of three numbers: -------------------------------------------------------------------------------- 1 | # Simple Python program to find sum of series 2 | # with cubes of first n natural numbers 3 | 4 | # Returns the sum of series 5 | def sumOfSeries(n): 6 | sum = 0 7 | for i in range(1, n + 1): 8 | sum += i * i*i 9 | 10 | return sum 11 | 12 | 13 | # Driver Function 14 | n = 5 15 | print(sumOfSeries(n)) 16 | 17 | # Code Contributed by Mohit Gupta_OMG <(0_o)> 18 | --------------------------------------------------------------------------------