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
Rom4ik [11]
3 years ago
10

Write a program that receives a series of numbers from the user and allows the user to press the enter key to indicate that he o

r she is finished providing inputs. After the user presses the enter key, the program should print:
The sum of the numbers

The average of the numbers

An example of the program input and output is shown below:

Enter a number or press Enter to quit: 1
Enter a number or press Enter to quit: 2
Enter a number or press Enter to quit: 3
Enter a number or press Enter to quit:

The sum is 6.0
The average is 2.0
BASE CODE

theSum = 0.0
data = input("Enter a number: ")
while data != "":
number = float(data)
theSum += number
data = input("Enter the next number: ")
print("The sum is", theSum)
Computers and Technology
1 answer:
kogti [31]3 years ago
5 0

Answer:

theSum = 0.0#defined in the question.

count=0 #modified code and it is used to intialize the value to count.

data = input("Enter a number: ") #defined in the question.

while data != "": #defined in the question.

   number = float(data) #defined in the question.

   theSum += number #defined in the question.

   data = input("Enter the next number or press enter to quit ") #defined in the question "only some part is modified"

   count=count+1#modified code and it is used to count the input to print the average.

print("The sum is", theSum)#defined in the question.

print("The average is", theSum/count) #modified code and it is used to print the average value.

output:

  • If the user inputs as 1,4 then the sum is 5 and the average is 2.5.

Explanation:

  • The above code is written in the python language, in which some part of the code is taken from the question and some are added.
  • The question has a code that tells the sum, but that code is not print the average value of the user input value.
  • To find the average, some codes are added, in which one count variable which is initialized at the starting of the program and gets increased by 1, when the user gives the value.
  • Then that count divides the sum to print the average.
You might be interested in
Question 1 Fill in the blank: Internet search engines are an everyday example of how Boolean operators are used. The Boolean ope
nikdorinn [45]

The Boolean operator OR expands the number of results when used in a keyword search. Thus, the correct option is D.

<h3>What is the Boolean operator?</h3>

The Boolean operator may be defined as an important tool that is utilized in the programming languages for the junctions to integrate or exclude keywords in a search, resulting in more attention and generative outcomes.

The Boolean operators are major of three types with specific functions and properties. They are:

  • AND
  • NOT
  • OR

Therefore, the Boolean operator OR expands the number of results when used in a keyword search. Thus, the correct option is D.

To learn more about Boolean operators, refer to the link:

brainly.com/question/1675220

#SPJ1

4 0
1 year ago
Pls help I will give points
Fed [463]

Answer:

phone !!

Explanation:

since it's a mobile app, that would apply to a handheld device !!

i hope this helps !!

3 0
3 years ago
Read 2 more answers
A coffee shop is considering accepting orders and payments through their phone app and have decided to use public key encryption
Charra [1.4K]

Answer: Yes

Explanation:

Public key encryption is the encryption technique that is used for private keys and public keys for securing the system.Public key is used for encryption and private key is for decryption.Public keys can only open content of the system

  • According to the question, public key encryption is secure for coffee shop customer payment process as they are stored on digital certificates in long form for verifying digital signature and encrypting information.Its computation is difficult to crack through power computer access.  
  • Other options is incorrect as encryption is not a problem for payment procedures. Thus, the correct option is yes ,public key encryption is secure method for coffee shop customers .
8 0
3 years ago
How many rows appear in a truth table for the compound proposition: \[(p \leftrightarrow q) \oplus (\neg p \leftrightarrow \neg
AURORKA [14]
Let me re-write the proposition:

p↔q⊕(¬p↔¬r)∧¬q.

Generally, the number of rows in a truth table depends on the number of Variables. Here we have 3 Variables: p,q and r. Each of them can have either the value of 1 or 0, which gives us 2*2*2 possibilities, or 2³, that is 8 possibilities and 8 rows:

p=0, q=0, r=0
p=0, q=0, r=1
p=0, q=1, r=0
p=0, q=1, r=1
p=1, q=0, r=0
p=1, q=0, r=1
p=1, q=1, r=0
p=1, q=1, r=1







4 0
2 years ago
How do i choose a most brainlyist
GuDViN [60]

Answer:

They’ll have to be 2 answers first, when 2 answers are given, you can choose which is branlyis. If there are no 2 answers, you can’t choose.

8 0
3 years ago
Read 2 more answers
Other questions:
  • Who would like to join a team devoted to decreasing spam and bullying?
    5·1 answer
  • what's the best mouse for fast clicking ? I play a lot of fps and a lot of pvp games I need a mouse that I can click fast with a
    14·1 answer
  • Universal Containers needs to add an additional recipient to a workflow email alert that isfired from the case object. What type
    6·1 answer
  • If anybody knows what does this mean I will answer any questions for you and plz answer this right plz what does that envelope w
    5·2 answers
  • Which term is defined as an exploit that takes place before the security community or software developer knows about the vulnera
    12·1 answer
  • Analyze the following code. Which of the following statements is correct?
    9·1 answer
  • Part 2: a) Write VHDL code for a top module that invokes necessary components to display the four decimal digits on four seven-s
    5·1 answer
  • What is wrong with the following code?
    11·1 answer
  • When an organizatin needs a program to do a very specific job, it mayhire someone to write _____ software.​
    10·1 answer
  • Which best explains a password attached to a document?
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!