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
What layer in the Transmission Control Protocol/Internet Protocol (TCP/IP) model is responsible for defining a way to interpret
sweet-ann [11.9K]

Answer:

The data-link layer

Explanation:

The physical layer and data-link layer are often confused a lot especially in terms of what they do in the TCP/IP 7 layer protocol. The physical layer as the name suggests represents the physical devices like the cables and the connectors that join or interconnect computers together. This layer is also responsible for sending the signals over to other connections of a network. The data-link, on the other hand, translates and interprets these sent binary signals so that network devices can communicate. This layer is responsible in adding mac addresses to data packets and encapsulating these packets into frames before being placed on the media for transmission. Since it resides in between the network layer and the physical layer, it connects the upper layers of the TCP/IP model to the physical layer.

3 0
3 years ago
15
iVinArrow [24]

I believe that the answer is A: Extension but I am not 100% sure, hope this helps.

7 0
3 years ago
Read 2 more answers
What are the two types of electronic components
IrinaVladis [17]

Answer:

The two type of electronic components are Active components and passive components

Active components are parts of a circuit that rely on an external power source to control or modify electrical signals. ... - Passive components like resistors, transformers, and diodes don't need an external power source to function. These components use some other property to control the electrical signal.

5 0
3 years ago
Read 2 more answers
February 1995, Kevin Mitnick was arrested. While on parole was he allowed to have a phone or computer?
m_a_m_a [10]

Answer:

He was not allowed on a phone of computer after being arrested.

Explanation:

If you read about it he wasn't even allowed to work at 7-11 because of an electronic cash register.

6 0
3 years ago
Read 2 more answers
1. In Access, a template is which of the following? a. A database to manage contacts b. Where a database is stored c. Two tables
sweet [91]
Where a database is stored
7 0
3 years ago
Other questions:
  • PLEASE HELP!<br> How do you "brainliest" an answer?
    13·2 answers
  • A relative path name defines a path from_________________________ Select one: a. from the UFD (user file directory) b. the curre
    6·1 answer
  • My question is do you learn how to do a voice over in technology?
    14·1 answer
  • I have a question. This question will probably be deleted, but why do moderators keep deleting my answers when they are legitima
    13·1 answer
  • Importance of computer​
    15·1 answer
  • Listed here are a few camera angles and their images.
    10·1 answer
  • Manfred wants to include the equation for the area of a circle in his presentation. Which option should he choose?
    11·2 answers
  • Role of memory in a computer system
    10·1 answer
  • What is the<br>Way to<br>keep the tool<br>Screw​
    6·1 answer
  • k-means clustering cannot be used to perform hierarchical clustering as it requires k (number of clusters) as an input parameter
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!