+ 1

why my programm doesn't work?

Hi everbody, I tried to make a programm to figure out what the average of entered numbers is. You should be able to enter first how many numbers and then the numbers. What did I wrong in the code? Here is the code: num_enters = int(input("How many numbers do you want to enter?")) list= [] for num in range(0, num_enters): numbers = int(input("Your numbers please:")) list.append(numbers) total = sum(list) average = total/len(list) print(average)

30th Dec 2021, 2:55 PM
David Lau
David Lau - avatar
4 Answers
+ 9
Looks like you're trying this on Sololearn code playground. The input system at Sololearn works differently. You need to give all your input at once in a newline. In your case it is for instance: 4 5 6 7 8 Now hit the submit
30th Dec 2021, 3:19 PM
Simba
Simba - avatar
+ 1
it's not an interactive as IDEs. just give all required inputs for code in pop up by space separated or in new line in required order at a time in pop-up box.. hope this code explains how solo learn input console works... https://code.sololearn.com/WhiNb9BkJUVC/?ref=app edit: https://www.sololearn.com/discuss/2807387/?ref=app
30th Dec 2021, 3:24 PM
Jayakrishna šŸ‡®šŸ‡³
0
It's working... What is wrong do you think? What is your expected output? Task description?
30th Dec 2021, 3:11 PM
Jayakrishna šŸ‡®šŸ‡³
0
Hi @Jayakrishna, thanks for your anwser. When I put the code in the sololearn playground and try to run the programm it just appears "Seems like your program requires an input" and not my question "How many numbers do you want to enter?" And when I put a number in the window, this error occures: How many numbers do you want to enter?Your numbers please: Traceback (most recent call last): File "file0.py", line 7, in <module> numbers = int(input("Your numbers please:")) EOFError: EOF when reading a line
30th Dec 2021, 3:18 PM
David Lau
David Lau - avatar