Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions avg_height.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#to calculate the average of a student height
student_heights = input("input a list of student heights: ").split()
for n in range (0, len(student_heights)):
student_heights[n] = int(student_heights[n])
print(student_heights)




total_height = 0
for height in student_heights:
total_height = total_height = height
print(total_height)


num_of_student = len(student_heights)
average_height = round(total_height / num_of_student)
print(average_height)