Ad
Code
Diff
  • def est_height(g,d,m):
        return(d+m+1)/2if g=="boy"else(d+m-1)/2
    • def est_height(gender,dad_height,mom_height):
    • return (dad_height+mom_height+1)/2 if gender == "boy" else (dad_height+mom_height-1)/2
    • def est_height(g,d,m):
    • return(d+m+1)/2if g=="boy"else(d+m-1)/2
Code
Diff
  • def est_height(gender, dad_height, mom_height):
        return (dad_height+mom_height+1)/2 if gender == "boy" else (dad_height+mom_height-1)/2
    • import statistics
    • def est_height(gender, dad_height, mom_height):
    • avg = statistics.mean([dad_height, mom_height])
    • return avg + 0.5 if gender is "boy" else avg - 0.5
    • return (dad_height+mom_height+1)/2 if gender == "boy" else (dad_height+mom_height-1)/2