-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
33 lines (25 loc) · 807 Bytes
/
main.py
File metadata and controls
33 lines (25 loc) · 807 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# 🚨 Don't change the code below 👇
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])
# 🚨 Don't change the code above 👆
#Write your code below this row 👇
#Opcion rapida
""""
total_height = sum(student_heights)
number_of_students = len(student_heights)
average_height = round(total_height / number_of_students)
print(average_height)
"""
#Opcion larga
#Sumamos las alturas
total_height = 0
for height in student_heights:
total_height += height
#Cuantos items hay en la list?
number_of_students = 0
for student in student_heights:
number_of_students += 1
#Promedio y round
average_height = round(total_height / number_of_students)
print(f"The average height is {average_height}")