- 1
Draw a decision tree for grade calculation
please use >90= A1, 80-90 =A2,70-80=B1, 60-70=B2 , 50-60=C1,40-50=C2,<40=F
3 Antworten
+ 2
I’m not sure if this is what you’re looking for but try this function:
def decideGrade(sc):
if sc >= 90:
return "A1"
elif sc >=80:
return "A2"
elif sc >=70:
return "B1"
elif sc >=60:
return "B2"
elif sc >=50:
return "C1"
elif sc >=40:
return "C2"
else:
return “F”
Then call it like this:
print(decideGrade(74));
Good luck!
+ 2
Not really a decision tree, but it's your homework, not mine
https://code.sololearn.com/craU3E9P6Eeq/?ref=app
0
thanks