Help me wiht python
An integer array of 30 elements is given. Array elements can take values from 1 to 5 – annual computer science assessments of graduating students. Describe the algorithm that calculates and outputs the average score among good performers (those who received a final grade of 4 or 5). It is guaranteed that there is at least one good teacher in the class.
Dmitry , > what kind of issue do you have? > please also save your code attempt in playground and link it here. without having seen your code if is difficulg to help.
Dmitry , i have taken your code and have tried some improvements, also some comments. 1) generating the array can be simplified (see the code sample) 2) see how the code could be working (see the code sample) https://code.sololearn.com/clafXZNMjYUT/?ref=app
Lothar, thank you very much✌️
from random import randint a= n=30 count=0 s=0 ball=0 for i in range(n): a.append(randint(1,5)) print(a) for j in range(n): if a[j] >=4: count+=1 print(count) I find it difficult that I don’t know how to declare the sum of the array elements (that is, the sum of all 4 and 5)
Simply add the elements that fit the condition to the variable s you declared and then divide it with count to get the average?