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
A man receives a fraudulent email from his bank asking him to confirm his user name and password by going to a particular websit
bonufazy [111]

Answer: The man's info has been found and a hacker was trying to make him confirm his passwrd so he can get a hold of it to hack the man further.

Explanation:

3 0
3 years ago
Firewalls are categorized into two; namely hardware firewall and software firewall. Identify the correct statement for a softwar
garri49 [273]

Answer:

Option (d) Software firewall is placed between the normal application and the networking components of the operating system

Explanation:

  • Software Firewalls protect the computer from trojans and malicious content which can arise from unsafe applications.
  • It also protect the computer from external network.
  • It filters the data to and from a software application in the desktop.
  • It also filters the data to and from a network.
  • It safeguards the computer from not loosing access to the attackers.
  • It is customizable software and has to be monitored like installing updates and storage spaces etc.
  • Software Firewall in conjunction with the Hardware Firewall must be used for the security of the desktop and the networks.
5 0
3 years ago
System analysis and design
Oksana_A [137]

Answer:

teachers go hard on you dont they

Explanation:

5 0
4 years ago
Question # 3
NeX [460]

what not understanding

4 0
3 years ago
Read 2 more answers
A(n) is the tool that will help you the most when developing the content you will use in your presentation.
ikadub [295]

Answer:

Outline

Hope it helps :)

Explanation:

7 0
3 years ago
Other questions:
  • How to become a software tester?
    11·1 answer
  • The technology that identifies people through bodily characteristics is known as
    10·1 answer
  • When 2 or more computers are connected it is called?
    14·1 answer
  • One of the most common causes of fires in the home and workplace is: a. All of the answer choices b. Arson c. Candle d. Faulty e
    6·1 answer
  • E-mail is the most common distributed application that is widely used across all architectures and vendor platforms.a) trueb) fa
    8·1 answer
  • What things have small motors
    13·1 answer
  • Define E-Mail Write any 4 special features of E-Mail ​
    13·1 answer
  • Which option is an appropriate database function syntax?
    15·2 answers
  • What's a pfp? I keep seeing it on scratch
    12·2 answers
  • What is a decryption key?​
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!