Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Hey! im trying to see where I went wrong: edit the program provided so that it receives a series of numbers from the user and
Hey! im trying to see where I went wrong:
Editilhe promearti proviskod so that it ahd alhiwn 1) insiciote thathe oe she (s feristoof prisiding meutit. Niet the Wor prumias the onleir foy. Li The sum at tha raminests 2. The wrarmgo of tho number Ari inaitiplecol the piograni irput and ousout is shown belowe finter on moks af pitedt fitefitgigu I Mtores the nusbin of torms entered byithe user n= Tloop unt 11 ueor presses the enter key Hinfinito loop While rruas b. Whet iser input fxom yier date inout (reiter it nuntier of press fnter to ouls: 16. 4 yeir ontugasd miter datal Wbreilin oustof the Inen breal mutber hind (idetal) thesun is nunter. Frins() 9 data = input("Enter a number or press Enter to quit: 10 1). H1f user pressed enter 12. if data== 14 Hbreak out of the 1 oop 15 break 16 17 Hconvert data into float using float( ) 18 number =f1aat(data) 20 \# add the entared number to theSum 21 theSum += number 22prlnt() 23. print ("The gum is, thesum") 24. \#if numbers of terms entered are Ereater than D if na0: H calculate average average = thesum. print( The average is: average) H II no terme azo ontered elses print(iaverage cundeflinesicos the number of terms ontered are g)? 3 \# stores the number of terms entered by the user n= \# Loop unt11 user presses the enter key 6. Infinite 100p 7 while True: 8. \#get user input from user data = Input ("Enter a number or preas Enter to quit: ") Hif user pressed onter 1. If dat a= Hbreak out of the loop break Hefonvert dotan inco float usine float() number = Hoart ( data ) If add the entered number te thesum. thesum t= number print() print ("The armi fs, thesumil) Editilhe promearti proviskod so that it ahd alhiwn 1) insiciote thathe oe she (s feristoof prisiding meutit. Niet the Wor prumias the onleir foy. Li The sum at tha raminests 2. The wrarmgo of tho number Ari inaitiplecol the piograni irput and ousout is shown belowe finter on moks af pitedt fitefitgigu I Mtores the nusbin of torms entered byithe user n= Tloop unt 11 ueor presses the enter key Hinfinito loop While rruas b. Whet iser input fxom yier date inout (reiter it nuntier of press fnter to ouls: 16. 4 yeir ontugasd miter datal Wbreilin oustof the Inen breal mutber hind (idetal) thesun is nunter. Frins() 9 data = input("Enter a number or press Enter to quit: 10 1). H1f user pressed enter 12. if data== 14 Hbreak out of the 1 oop 15 break 16 17 Hconvert data into float using float( ) 18 number =f1aat(data) 20 \# add the entared number to theSum 21 theSum += number 22prlnt() 23. print ("The gum is, thesum") 24. \#if numbers of terms entered are Ereater than D if na0: H calculate average average = thesum. print( The average is: average) H II no terme azo ontered elses print(iaverage cundeflinesicos the number of terms ontered are g)? 3 \# stores the number of terms entered by the user n= \# Loop unt11 user presses the enter key 6. Infinite 100p 7 while True: 8. \#get user input from user data = Input ("Enter a number or preas Enter to quit: ") Hif user pressed onter 1. If dat a= Hbreak out of the loop break Hefonvert dotan inco float usine float() number = Hoart ( data ) If add the entered number te thesum. thesum t= number print() print ("The armi fs, thesumil) edit the program provided so that it receives a series of numbers from the user and allows the user to press the enter key to indicate that he or she is finished providing inputs. after the user presses the enter key, the program should print.
1. the sum of the numbers
2. the average of the numbers
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started