1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
IRISSAK [1]
3 years ago
7

Implement a function inValues() that asks the user to input a set of nonzero floating-point values. When the user enters a value

that is not a number, give the user a second chance to enter a value. After two mistakes in a row, quit the program. When the user enters 0, the function should return the sum of all correctly entered values. Use exception handling to detect improper inputs.
Computers and Technology
1 answer:
elena-s [515]3 years ago
5 0

Answer:

Explanation:

The following is written in Python and uses exception handling to do exactly as requested. It then goes adding all of the integer values to an array called num_list and finally adding them all together when the function ends.

def in_values():

   num_list = []

   while True:

       try:

           num = input("Input non-zero floating point: ")

           num = int(num)

           if num == 0:

               break

           else:

               num_list.append(num)

       except ValueError:

           print("No valid integer! Please try again ...")

           try:

               num = input("Input non-zero floating point: ")

               num = int(num)

               break

           except ValueError:

               break

   sum = 0

   for number in num_list:

       sum += number

   return sum

You might be interested in
ENG103 DISCUSSION BOARD 6
amm1812
The proper citation for your course of study -computer related- is APA (American Psychological Association)  format. This citation format allows us to state the publication date, title , and authors in an organized and short fashion. All scholarly reports that are technology or psychology based, should be cited in APA format. 

<span>I know this because it is the format I use for all of my college courses which are all Computer/Technology related. </span>
3 0
3 years ago
What are village by laws​
melomori [17]

Explanation:

LAWS have long been familiar to the student of the English village. these regulations dealt mai ly with the open-field husbandry and pasture rights of ....

4 0
3 years ago
Emma is creating a database to track sales. She wants to be able to sort by price and sales associate. And she would like to loo
alexira [117]

Barcode number, description, price, and sales associate.

5 0
3 years ago
Read 2 more answers
True or false word inserts text to the right Of the insertion point
uysha [10]
False.................................
3 0
3 years ago
What is the name of the method of problem solving that breaks a problem imto smaller problems​
Basile [38]

Answer:

The first thing that came to mind was when my parents tell me "Take it one step at a time" I hope this helps

Explanation:

7 0
3 years ago
Other questions:
  • Which resource helps a user access a cloud service?
    13·2 answers
  • The main circuit board in a computer is called the ________. RAM dongle motherboard power supply unit
    14·1 answer
  • What does the security element of non-repudiation mean in e-commerce cybersecurity? A. Data needs to be available at all times.
    10·1 answer
  • What's does the Mutual Reward Theory state?
    10·1 answer
  • When do on loop conditions happen? (1 point)
    5·1 answer
  • A​ client-server application that requires nothing more than a browser is called​ ________.
    8·2 answers
  • What kind of battery does a dji spark have?
    12·1 answer
  • IBC Question: You are writing a JavaScript program for Blue Yonder Airlines. The program stores various information about the ai
    13·1 answer
  • Why is internet download speed slower on a computer vs phone
    5·1 answer
  • Shreya has combined all the cells in a single leftmost column in a table. Instead of identifying the category multiple times, sh
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!