Write a program that will input a list of test scores in from the keyboard. When the user enters -1, print the average.
2 answers:
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.
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
Answer:
A power supply consists of wires connecting the cpu and other parts of the computer. The data bus transfers data between CPU and memory unit.
Explanation:
Integer Integer Integer Integer Integer Integer Integer Integer Integer Integer Integer Integer Integer Integer Integer
A select query
select column1, column2, columnN
from table
where condition
order to be pretty;
Explanation:
It's placed near the door. When a visitor presses the button, the bell rings inside alerting you that someone is at the door.
Answer:
library
Explanation:
hope you like it