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
yKpoI14uk [10]
3 years ago
6

Write a program that will input a list of test scores in from the keyboard. When the user enters -1, print the average.

Computers and Technology
2 answers:
never [62]3 years ago
7 0

print("Enter the Scores:")

total = []

while True:

   num = int(input())

   if num == -1:

       break

   total.append(num)

print("The average is:",(sum(total)/len(total)))

I wrote my code in python 3.8. Also, you have to be careful about adding -1 to the total. You don't want to count -1 in the average.

aivan3 [116]3 years ago
3 0

Answer: -1 usually represents infinity.

Explanation:

It would keep going forever and not be able to stop without manually stopping it.

You might be interested in
Suppose we have two String objects and treat the characters in each string from beginning to end in the following way: With one
Simora [160]

Answer:

If all the character pairs match after processing both strings, one string in stack and the other in queue, then this means one string is the reverse of the other.                            

Explanation:

Lets take an example of two strings abc and cba which are reverse of each  other.

string1 = abc

string2 = cba

Now push the characters of string1 in stack. Stack is a LIFO (last in first out) data structure which means the character pushed in the last in stack is popped first.

Push abc each character on a stack in the following order.

c

b

a

Now add each character of string2 in queue. Queue is a FIFO (first in first out) data structure which means the character inserted first is removed first.

Insert cba each character on a stack in the following order.

a   b   c

First c is added to queue then b and then a.

Now lets pop one character from the stack and remove one character from queue and compare each pair of characters of both the strings to each other.

First from stack c is popped as per LIFO and c is removed from queue as per FIFO. Then these two characters are compared. They both match

c=c. Next b is popped from stack and b is removed from queue and these characters match too. At the end a is popped from the stack and a is removed from queue and they both are compared. They too match which shows that string1 and string2 which are reverse of each other are matched.

6 0
3 years ago
What is software piracy
Tju [1.3M]
Software piracy is the illegal copying, distribution, or use of software.
8 0
3 years ago
Read 2 more answers
When somthing is trustworthy we call it what?
Gnom [1K]

Answer:

dependable

Explanation:

5 0
3 years ago
Read 2 more answers
True or false :Beyond fulfilling legal obligations, a diverse workplace offers many other benefits as well.
KengaRu [80]
The answer to your question is true.
7 0
3 years ago
Write a program that prints the U.S. presidential election years from 1792 to present day, knowing that such elections occur eve
Naddika [18.5K]
Year = 1972
current year = 2021

while year <= current year:
print (year)
year = year + 4
8 0
2 years ago
Other questions:
  • Application partitioning gives developers the opportunity to write application code that can later be placed on either a client
    7·1 answer
  • How can you remove heat from a computer?
    10·1 answer
  • Why are computers complicated?
    15·1 answer
  • Type the correct answer in the box. Spell all words correctly.
    13·1 answer
  • I need help thanks please!
    8·2 answers
  • A student will not be allowed to sit in exam if his/her attendance is less than 75% .
    8·1 answer
  • Write pseudocode for washing a car using at least five steps.
    13·1 answer
  • Turns on her laptop and gets the error message "OS NOT FOUND." She checks the hard disk for damage or loose cable, but that is n
    11·1 answer
  • 4.(L.5.1.A) Select the sentence that includes an interjection,
    12·1 answer
  • Which scenario is most likely due to an everyday problem rather than a
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!