14. Loops - while loop

۰ نظر گزارش تخلف
Farnaz Baghban
Farnaz Baghban

Calculating the Average Exercise

Construct an application that calculates the average of the first 10 items - starting with 1. So [1,2,3,4,5,6,7,8,9,10] these are the numbers you have to consider - with loops of course :)

Good luck

================================================================
Calculating the Average Solution

item_counter = 0
sum = 0

for item in range(1, 11):
sum += item
item_counter += 1

print('Average of the first 10 items (starting with 1) is: ' + str(sum/item_counter))

نظرات

در حال حاضر امکان درج نظر برای این ویدیو غیرفعال است.

توضیحات

14. Loops - while loop

۰ لایک
۰ نظر

Calculating the Average Exercise

Construct an application that calculates the average of the first 10 items - starting with 1. So [1,2,3,4,5,6,7,8,9,10] these are the numbers you have to consider - with loops of course :)

Good luck

================================================================
Calculating the Average Solution

item_counter = 0
sum = 0

for item in range(1, 11):
sum += item
item_counter += 1

print('Average of the first 10 items (starting with 1) is: ' + str(sum/item_counter))