วันอาทิตย์ที่ 20 กันยายน พ.ศ. 2558

Lab4x-Grade

def BMI(weight,heightM):
  heightCm=heightM/100
  BMI = weight/(heightCm**2);
  print("height=",heightM,"m")
  print("weight=",weight,"kg")
  print("BMI=",BMI)

BMI(71,167)   

#grade
def grade(score):
     text="\"your grade is"
     if(score<50):
        print(text,'F')
        print("You should have more practice")
     elif(score>=50 | score<=59):
        print(text,'D')
     elif(score>=60 | score<=69):
        print(text,'C')
     elif(score>=70 | score<=79):
        print(text,'B')
     elif(score>=80 | score<=100):
        print(text,'A')

grade(70)

ไม่มีความคิดเห็น:

แสดงความคิดเห็น