EX1
1 หาค่าปกติจาก Ref
2 หา % ตาราง 2 ได้
- ไม่มี UI
- ไม่มี Writing
Code Python
def allpredictv (): if Gent=="m": FVC = (-2.601)+(0.122*A)-(0.00046* (A**2))+(0.00023* (H**2))-(0.00061*A*H) FEV1 = (-7.697)+(0.123*A)+(0.067*H)-(0.00034*(A**2))-(0.0007*A*H) FF = 19.362+(0.49*A)+(0.829*H)-(0.0023*(H**2))-(0.0041*(A*H)) PEF = (-16.859)+(0.307*A)+(0.141*H)-(0.0018* (A**2))-(0.001*(A*H)) print ("FVC = ",FVC,"\n","FEV1 = ",FEV1,"\n","percent FEV1/FVC= ",FF,"\n","PEF = ",PEF ) return FVC,FEV1,FF,PEF elif Gent=="w": FVC = (-5.914)+(0.088*A)+(0.056*H)-(0.0003*(A**2))-(0.0005*A*H) FEV1 = (-10.6)+(0.085*A)+(0.12*H)-(0.00019*(A**2))-(0.00022*(H**2))-(0.00056*(A*H)) FF = 83.126+(0.243*A)+(0.084*H)+(0.002*(A**2))-(0.0036*(A*H)) PEF = (-31.355)+(0.162*A)+(0.391*H)-(0.00084*(A**2))-(0.00099*(H**2))-(0.00072*(A*H)) print ("FVC = ",FVC,"\n","FEV1 = ",FEV1,"\n","percent FEV1/FVC= ",FF,"\n","PEF = ",PEF ) return FVC,FEV1,FF,PEF else : print ("Error จบการทำงาน") def percentpredictv (): PerpredictedFVC = (B*100)/((-2.601)+(0.122*A)-(0.00046* (A**2))+(0.00023* (H**2))-(0.00061*A*H)) PerpredictedFEV1 = (C*100)/((-7.697)+(0.123*A)+(0.067*H)-(0.00034*(A**2))-(0.0007*A*H)) PerpredictedFF = (D*100)/(19.362+(0.49*A)+(0.829*H)-(0.0023*(H**2))-(0.0041*(A*H))) PerpredictedPEF = (E*100)/((-16.859)+(0.307*A)+(0.141*H)-(0.0018* (A**2))-(0.001*(A*H))) ''' PerpredictedFVC = (-2.601)+(0.122*A)-(0.00046* (A**2))+(0.00023* (H**2))-(0.00061*A*H) PerpredictedFEV1 = (-7.697)+(0.123*A)+(0.067*H)-(0.00034*(A**2))-(0.0007*A*H) PerpredictedFF = 19.362+(0.49*A)+(0.829*H)-(0.0023*(H**2))-(0.0041*(A*H)) PerpredictedPEF = (-16.859)+(0.307*A)+(0.141*H)-(0.0018* (A**2))-(0.001*(A*H)) ''' print ("FVC% = ",PerpredictedFVC,"\n","FEV1% = ",PerpredictedFEV1,"\n","percent FEV1/FVC %= ",PerpredictedFF,"\n","PEF% = ",PerpredictedPEF ) return PerpredictedFVC,PerpredictedFEV1,PerpredictedFF,PerpredictedPEF A = int(input("อายุของผู้ทดลอง (ปี) = ")) H = int(input("ส่วนสูงของผู้ทดลอง (cm) = ")) Gent = input("เพศ หญิง=w ชาย=m ผู้ทดลอง= ") allpredictv() while True: B = float(input("FVC ที่ผู้ทดลองวัดได้ (L) = ")) #FVC C = float(input("FEV1 ที่ผู้ทดลองวัดได้ (L) = ")) #FEV1 D = float(input("FEV1/FVC ที่ผู้ทดลองวัดได้ (%) = ")) # % E = float(input("PEF ที่ผู้ทดลองวัดได้ (L/sec) = ")) # PEF percentpredictv()
Comments