Situational Problem:

Camille has a grade in the following subject:

Araling Panlipunan (99)

Science (96)

English (90)

Filipino (91)

Math (94)

TLE (93)

What is the sum and average grade of Camille with the use of data in compiling an array?

+1 vote

You can calculate the sum by adding all of those numbers (so 99 + 96 + 90 + 91 + 94 + 93 = *you do the calcualtion*).

You can calculate the average by adding all the numbers (, that is, using the sum), then dividing it by the number of elements added (in your case, that's 6).

If you store things in an array, you need to iterate through the array and take the values from the array. Then the number of elements in the array is the length of the array.

Try to write some code and share it if you get stuck. Also, include what language are you after.

You can calculate the average by adding all the numbers (, that is, using the sum), then dividing it by the number of elements added (in your case, that's 6).

If you store things in an array, you need to iterate through the array and take the values from the array. Then the number of elements in the array is the length of the array.

Try to write some code and share it if you get stuck. Also, include what language are you after.

+1 vote

a = [99,96,90,91,94,93]

b = len(a)

sum1 = 0

for i in a:

sum1 = sum1 + i

print("sum of the all subject is ",sum1)

average = sum1/b

print("average is ",average)

b = len(a)

sum1 = 0

for i in a:

sum1 = sum1 + i

print("sum of the all subject is ",sum1)

average = sum1/b

print("average is ",average)

+1 vote

Add on the numbers together (563 in this case), then divide that by how many numbers you have (6 in this case) and you get 93.83.

...

sum1=Suma+a[i]