Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

Python Question Create a function called avgSumOfSquares that expects no arguments. Instead, this function gets its input from the user at the keyboard. The function

Python Question 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 numbers, one at a time. The user types end to indicate that there are no more numbers. The function computes 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 that 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. (This has to be done with while loop, and lists is not allowed) 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 38.285714285714285

>>> avgSumOfSquares()

Enter next number: 3.27

Enter next number: -1.9

Enter next number: 6 Enter next number: -1

Enter next number: end

The average of the sum of the squares is: 12.825725 12.825725

>>> avgSumOfSquares()

Enter next number: end

No numbers were entered.

>>> x = avgSumOfSquares()

Enter next number: end

No numbers were entered.

>>> print(x)

None

>>> x = avgSumOfSquares()

Enter next number: -1

Enter next number: 2

Enter next number: -3

Enter next number: end

The average of the sum of the squares is: 4.666666666666667

>>> print(x) 4.666666666666667

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image
Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Current Trends In Database Technology Edbt 2006 Edbt 2006 Workshops Phd Datax Iidb Iiha Icsnw Qlqp Pim Parma And Reactivity On The Web Munich Germany March 2006 Revised Selected Papers Lncs 4254

Authors: Torsten Grust ,Hagen Hopfner ,Arantza Illarramendi ,Stefan Jablonski ,Marco Mesiti ,Sascha Muller ,Paula-Lavinia Patranjan ,Kai-Uwe Sattler ,Myra Spiliopoulou ,Jef Wijsen

2006th Edition

3540467882, 978-3540467885

More Books

Students explore these related Databases questions

Question

How do members envision the ideal team?

Answered: 3 weeks ago

Question

b. Does senior management trust the team?

Answered: 3 weeks ago