Feb-03-2018, 10:12 AM
Hello,
I am trying to create a program which reads a number N>=2 and creates a list. Then it fills the list with numbers and finds the average of them. Finally, it finds the amount of numbers which are greater than the average and it shows the percentage of them. There is a problem in my code, but I can't understand what it is. The problem is that it doesn't run at all. I believe it is probably a syntax error or something, but I don't know what. I use Python 3.6.4 at Windows 10 if that helps. I am a beginner at coding and python, so please be gentle.
Thank you in advance
Here is my code:
I am trying to create a program which reads a number N>=2 and creates a list. Then it fills the list with numbers and finds the average of them. Finally, it finds the amount of numbers which are greater than the average and it shows the percentage of them. There is a problem in my code, but I can't understand what it is. The problem is that it doesn't run at all. I believe it is probably a syntax error or something, but I don't know what. I use Python 3.6.4 at Windows 10 if that helps. I am a beginner at coding and python, so please be gentle.
Thank you in advance
Here is my code:
A=[] average=0 max=0 N=int(input("Give the number of data of the list\n\n") if (N<2): print ("The number you gave is wrong\n\n") while (N<2): N=int(input("Give the number of data of the list again\n\n") print ("Give the numbers of the list\n\n") for i in range(1,N): A[i]=int input average=average+A[i] average=average/N print ("The average is", average) for i in range (1,N): if (A[i]>average): max++ num=100/N max=max*num print("The percentage of the data which are grater than the average is %s%", max