Skip to content

Commit 86851f4

Browse files
bites 191 - improve code readability
1 parent 3b5316b commit 86851f4

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

191/bmi.py

+5-8
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,11 @@
2828
def person_max_bmi(data=data):
2929
"""Return (name, BMI float) of the character in data that
3030
has the highest BMI (rounded on 2 decimals)"""
31-
BMIdict = dict()
31+
BMIs = dict()
3232
for line in data.splitlines():
3333
line = dedent(line)
34-
entry=line.split(',')
35-
name = entry[0]
36-
height = entry[1]
37-
mass = entry[2]
34+
name, height, mass = line.split(',')
3835
BMI = float(mass) / ((int(height) / 100) ** 2)
39-
BMIdict.update({name:round(BMI,ndigits=2)})
40-
sortedbmilist = sorted(BMIdict.items(),key= lambda x: x[1])
41-
return sortedbmilist[-1]
36+
BMIs.update({name:round(BMI,ndigits=2)})
37+
sortedbmis = sorted(BMIs.items(),key= lambda x: x[1])
38+
return sortedbmis[-1]

0 commit comments

Comments
 (0)