Skip to content

Commit 9246373

Browse files
committed
Solve q1 and q2
1 parent bf1a7a1 commit 9246373

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

q2/inu/q1.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# for q1
2+
member = {}
3+
4+
for line in open('../data.txt', 'r'):
5+
name, height, weight = line.split(',')
6+
member[name] = { "height": float(height), "weight": float(weight) }
7+
8+
def bmi_calculator(name, member_list):
9+
if name in member_list:
10+
person = member_list[name]
11+
weight, height = person["weight"], person["height"]
12+
return weight / ((height/100)**2)
13+
else:
14+
return "Invalid name"

0 commit comments

Comments
 (0)