Read numbers from the user until -1 is encountered. And then find the sum and mean of the given number | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Read numbers from the user until -1 is encountered. And then find the sum and mean of the given number

20th May 2021, 1:58 AM
Vammi siva
Vammi siva - avatar
10 Answers
0
Anybody explain and write programme
20th May 2021, 2:01 AM
Vammi siva
Vammi siva - avatar
0
what language is this
20th May 2021, 2:02 AM
CutieRei
CutieRei - avatar
20th May 2021, 2:02 AM
Vammi siva
Vammi siva - avatar
0
you could use a while loop like this numbers = [] while True: num = int(input("Number: ") if num == -1: print("Sum:", sum(numbers)) print("Mean:", (sum(numbers))/len(numbers)) break numbers.append(num)
20th May 2021, 2:04 AM
CutieRei
CutieRei - avatar
0
although you could make your own implementation, im only giving you an example
20th May 2021, 2:05 AM
CutieRei
CutieRei - avatar
0
You well python
20th May 2021, 2:06 AM
Vammi siva
Vammi siva - avatar
0
pardon?
20th May 2021, 2:06 AM
CutieRei
CutieRei - avatar
0
You complete python and another you help me in python I am a beginner
20th May 2021, 2:09 AM
Vammi siva
Vammi siva - avatar
0
ah well that's great welcome to the community, hope you'll be a good programmer soon(not saying you're not good) have a great day
20th May 2021, 2:11 AM
CutieRei
CutieRei - avatar
0
You are job doing study like btech
20th May 2021, 2:12 AM
Vammi siva
Vammi siva - avatar