You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
560 B
24 lines
560 B
9 months ago
|
# expected results
|
||
|
# total height = 475
|
||
|
# number of students = 3
|
||
|
# average height = 158
|
||
|
|
||
|
student_heights = ["151", "145", "179"]
|
||
|
for n in range(0, len(student_heights)):
|
||
|
student_heights[n] = int(student_heights[n])
|
||
|
|
||
|
#####
|
||
|
|
||
|
total_height = 0
|
||
|
for h in student_heights:
|
||
|
total_height += h
|
||
|
print(f"total height = {total_height}")
|
||
|
|
||
|
number_of_students = 0
|
||
|
for s in student_heights:
|
||
|
number_of_students += 1
|
||
|
print(f"number of students = {number_of_students}")
|
||
|
|
||
|
average_height = total_height / number_of_students
|
||
|
print (f"average height = {average_height}")
|