avgSumOfSquares solution

$14.99

Original Work ?

Download Details:

  • Name: work-1.zip
  • Type: zip
  • Size: 96.60 KB

Category: You will Instantly receive a download link upon Payment||Click Original Work Button for Custom work

Description

5/5 - (2 votes)

Problem 6 Create a function called avgSumOfSquares that expects no arguments. Instead, this function gets its input from the user at the keyboard. The function asks the user to enter a series of numbe rs , one at a time. The user types end to indicate that there are no more numbers. The function compute s the average of the sum of the squares of all the values entered . For example, given the values 6, – 3, 4, 2, 11, 1, and – 9, the sum of the squares would be (36 + 9 + 16 + 4 + 121 + 1 + 81) = 268. The average of the sum of squares would then be 268/7 = 38.285714285714285 . The function then prints the average of the sum of the squares and returns t hat average . However, if end is entered before any values are entered, the function notifies the user that no numbers were entered and returns None . You may assume the user inputs are valid: they will either be a number or the string end . Here are some examples of how your function should behave: avgSumOfSquares()

Enter next number: 6

Enter next number: – 3

Enter next number: 4

Enter next number: 2

Enter next number: 11

Enter next number: 1

Enter next number: – 9

Enter next number: end

The average of the sum of the squares is: 38.285714285714285Β 

avgSumOfSquares()

Enter next number: 3.27

Enter next number: – 1.9

Enter next numbe r: 6

Enter next number: – 1

Enter next number: end

The average of the sum of the squares is: 12.825725