Question: LAB 7 WHILE LOOPS In this lab, you will work with while loops and reading from a file A. In the file lab7.py, write code

 LAB 7 WHILE LOOPS In this lab, you will work with

LAB 7 WHILE LOOPS In this lab, you will work with while loops and reading from a file A. In the file lab7.py, write code that will do the following: 1. Write a while loop that will do the following: for each iteration it asks the user to input a floating point number. The square of each of the input values will be added in a variable sum. When the user inputs the null string, the while-loop will be exited and the average of the sum of the squares of the input will be printed. 2. Add code to the lab7.py file so that in addition to the previous part, it repeats the same functionality with the difference that the numbers, one per line, can be found in a file values.txt. Please note that you have to open the file for reading, one line at the time. The file contents need to be modified to reflect the set of numbers that are desired to be the input. B. Make sure you include a header in Lab5.py, as always, along these lines: # CSE 201-01 Winter 2020 # Lab 7 # Name: [Your name] # File: Lab7.py # Title: While-loops and reading from a file. # Program using while-loops to calculate the average of the inputs # (1) as input from the user, one by one, and (2) as inputs from a file. # Input: a number of floating point values. # Output: The average of the floating point numbers. C. What to turn in both in hardcopy in lab and electronically on Blackboard: 1. The file "Lab7.py" which contains the program. 2. Two screenshot with runs for inputs 2.1, 3.1, 4.1, 5.1, and then for inputs 2.1, 3.1, 5.1,6.1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!