Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

# average3.py def main(): sum = 0.0 count = 0 x = eval(input(Enter a number (negative to quit) >> )) while x >= 0: sum

# average3.py def main(): sum = 0.0 count = 0 x = eval(input("Enter a number (negative to quit) >> ")) while x >= 0: sum = sum + x count = count + 1 x = eval(input("Enter a number (negative to quit) >> ")) print(" The average of the numbers is", sum / count) main()

_______________________________________________________________________________

# average4.py def main(): sum = 0.0 count = 0 xStr = input("Enter a number ( to quit) >> ") while xStr != "": x = eval(xStr) sum = sum + x count = count + 1 xStr = input("Enter a number ( to quit) >> ") print(" The average of the numbers is", sum / count) main()

Test files average3.py, average4.py

With a single .txt file, revise files with line-by-line explanation. (Using # to add comment/explanation)

One file with line-by-line explanation, followed by one running result with IDLE shell information (try to use the same testing inputs to see the differences between each .py files).

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

Step: 3

blur-text-image

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

Databases And Python Programming MySQL MongoDB OOP And Tkinter

Authors: R. PANNEERSELVAM

1st Edition

9357011331, 978-9357011334

More Books

Students also viewed these Databases questions

Question

How wide are Salary Structure Ranges?

Answered: 1 week ago