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
Why does Homework exist? Why is it so important?
padilas [110]

Answer:It's not at all

Explanation:

4 0
2 years ago
Read 2 more answers
What line of business (L'Oréa)?​
tatiyna

Answer:

skin care personal care

Explanation:

just search up what line of business in l orea

6 0
2 years ago
Read 2 more answers
What were the names of Henry VIII's six wives?
timurjin [86]

Answer:

Jane Seymour,Anne Boleyn,Katherine of Aragon,Anne of Cleves,Katherine Howard,Katherine Parr

Explanation:

7 0
1 year ago
Read 2 more answers
Select a cybersecurity career that interests you. Describe the job duties and identify the skills required to excel in that care
kykrilka [37]

Answer:

it's business

Explanation:

business you started with small and work for it grow up.

3 0
3 years ago
Best practices and trends for technology integration
cluponka [151]

Answer:

Technology use must be aligned to the standards. Technology must be integrated into daily learning,

Explanation:

Technology use must be aligned to the standards. Technology must be integrated into daily learning, not used as an add-on to instruction to match personal learning needs. Students need opportunities to use technology collaboratively. Technology must support project based learning and include real-world simulations.

3 0
2 years ago
Other questions:
  • Suppose you were assigned to develop a logical model of the registration system at a school or college. would you be better off
    9·1 answer
  • Many 12-15 yrs hv access to the internet which cannot be supervised by an adult.i need 5 problems tht this might cause
    5·1 answer
  • Which email client feature allows you to store the names and information of people you contact frequently?
    5·1 answer
  • Which method of accessing FTP has the most limited capabilities?
    9·2 answers
  • Around what time did the Internet come around and how did it all start? Would like to know more of the history of how the intern
    12·1 answer
  • What can be the maximum possible length of an identifier 3163 79 can be of any length​
    5·1 answer
  • Write two example use of relationships ICT
    11·1 answer
  • 11 Select the correct answer. Which external element groups items in a design?
    9·1 answer
  • Write a for loop that uses the loop control variable to take on the values 0 through 10.
    10·1 answer
  • Consider our authentication protocol 4.0, in which Alice authenticates herself to Bob, which we saw works well (i.e., we found n
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!