Question: Please Answer in python as soon as possible thanks OBJECTIVES i. To understand repetition structures ii. To use while loops in a program iii. To
OBJECTIVES i. To understand repetition structures ii. To use while loops in a program iii. To understand break and/or continue instructions 1. Write a Python program (with comments) to do the following: a. Create a variable sum and initialize it to 0 b. Create a variable numbers and initialize it to [] (i.e. an empty list) c. while sum is less than 100, do the following inside a loop: i. Ask the user to enter a number between 10 and 20 or -1 to exit. Assume they will enter a valid input. ii. If the user entered -1, print 'Ending session' and immediately exit from the loop iii. Otherwise: 1. Convert the entered value to type float and append to the list numbers. 2. Add the number entered to sum. After exiting the loop: d. Print the list of numbers entered by the user. e. Print how many numbers the user entered and f. Print the average of all the numbers (between 10 and 20) entered by the user, if they entered at least 1 such number. g. Save your code to a file with name labosol.py. h. Submit your Python code (i.e. lab.sol.py file) through BB A sample session is shown below
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
