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
Which of the following is ideal for long distance communication ?
Vinvika [58]
Microwave transmission is ideal for long distance communication. It is so good that it is used for satellite and space probe communication.
3 0
4 years ago
This algorithm requires you to find the perimeter of 12 different squares.
k0ka [10]

Answer:

BEGIN

SET count = 1

WHILE count <= 12 THEN

     INPUT length

     perimeter = length * length

     PRINT perimeter

END WHILE

END

Explanation:

You can also set count to 0 and in while loop use count < 12 to loop just 12 times just as above

4 0
3 years ago
Suggest ways in which web designers can use color to make a statement about the subject of a web page, a brand, or the website i
Ulleksa [173]

Hi. :")

As it is used to attract interest in advertisements, different colors can be used in order to attract attention here. Or the upper left corner technique can be used. The important contents are placed in the upper left corner. Because, in the country where I live, in the technology design class, people have always studied the upper left corner further.

Good Luck!

#Turkey

4 0
3 years ago
Types of Hazards Mitigation Measures
Fynjy0 [20]

Answer:

auto mechanics

Explanation:

keeps dirt and grease off hands

4 0
3 years ago
Read 2 more answers
A counter is a tool used to measure the number of times people visit a Web site. true or false?
Liono4ka [1.6K]

True.

It doesn't measure unique users, so you can just hit refresh and the counter keeps going up...

5 0
3 years ago
Other questions:
  • Which of the following BEST represents the relationship between physical fitness and exercise?
    6·1 answer
  • Can you give me a long list of kid's cartoons
    8·2 answers
  • What is virtual memory?
    11·1 answer
  • Median of a sample If the distribution is given, as above, the median can be determined easily. In this problem we will learn ho
    15·1 answer
  • In order to plan George’s birthday, his father gave him a list of people who attended his birthday for the last five years. What
    8·1 answer
  • T.J. wants to send a friend a file with a funny dancing cat. Which file format should T.J. use?
    13·2 answers
  • sara has just started using the Internet. She would like to be more efficient . In 3-4, give sara some advice about how to be mo
    5·1 answer
  • when you enter a formula in a cell the result of the calculation displays in a cell. how do views of formula after entering it?
    9·2 answers
  • Point out the wrong statement:
    7·1 answer
  • What is the meaning of compiler​
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!