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
Complete the statement below using the correct term.
julia-pushkina [17]

Answer:

im pretty sure it is the implementation phase. But i can't be too sure about it.

5 0
3 years ago
What does the asterisk (*) after select tell the database to do in this query?
OlgaM077 [116]

In the case above, The asterisk helps database or tell it to select all data that meets the criteria as stated in the query.

<h3>What does asterisk (*) mean in SQL?</h3>

The term means all columns. Note that The asterisk or star symbol ( * ) is a term that implies all columns in a given database.

Therefore, In the case above, The asterisk helps database or tell it to select all data that meets the criteria as stated in the query.

Learn more about asterisk from

brainly.com/question/1620017

#SPJ11

4 0
2 years ago
) A byte is used to represent a single character in the computer ______<br> true or false?
sdas [7]
Answer: false
Explanation:
7 0
3 years ago
Read 2 more answers
The smallest signed integer number, base 16, that can be store in a variable of type BYTE is__________.
sveta [45]

Answer:

The correct answer is ushort

8 0
4 years ago
Create a float variable named diameter. This variable will hold the diameter of a circle. d. Create a float variable named PI.
Basile [38]

Answer:

float diameter=2*r; //hold the diameter of a circle

float PI; // float variable named PI.

Explanation:

Here we have declared two variable i.e diameter and PI of type float. The variable diameter will hold the diameter of a circle i.e  2*r  where r is the radius of a circle.

Following are the program in c++

#include <iostream> // header file

using namespace std; // namespace

int main() // main function

{

   float r=9.2; // variable declaration

float diameter=2*r; //hold the diameter of a circle

float PI=3.14; // float variable named PI hold 3.14

cout<<"diameter IS :"<<diameter<<endl<<"PI IS :"<<PI; // display value

  return 0;

}

Output:

diameter IS :18.4

PI IS :3.14

8 0
3 years ago
Other questions:
  • In the following statement:
    12·1 answer
  • Materials that allow electricity to flow are called A) Metals B) Attractors C) Conductors D) Insulators
    11·2 answers
  • List and describe the issues that lead to making a successful website?​
    9·1 answer
  • What does a contain after the following code runs?int[] a = {1, 3, 7, 0, 0, 0};int size = 3, capacity = 6, value = 5;int pos = 0
    10·1 answer
  • When studying an information system, illustrations of actual documents should be collected using a process called _____.
    12·1 answer
  • Diagnosing is solving the problem, and trouble shooting is figuring out what the problem is.
    15·1 answer
  • As the project manager for a software development project, you are helping to develop the project schedule. You decide that writ
    13·1 answer
  • What are comments meant to do?
    12·1 answer
  • Using a windows computer, to make a window wider, you would move the pointer until it changes to the horizontal resize shape and
    6·1 answer
  • Write a Java Program that can compute the mean, median, the highest, and the lowest of the students’ scores in a class. First, t
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!