Hi i can't use else after elif statement

def applicant_selector(gpa, ps_score, ec_count):
if gpa >= 3.0 and ps_score >= 90 and ec_count >= 3:
return “This applicant should be accepted.”
elif not ec_count >= 3:
return “This applicant should be given an in-person interview.”
return “This applicant should be rejected.”

So i was playing with the code in the Python Control Flow, problem is if i use else statement after elif statement i can’t get required output which should be “This applicant should be rejected.”

Hey, welcome to the forums!

If it’s a matter of not getting the right out put, you can check how your if-statements are evaluating with print statements.

for example:

print(True == True)
# prints True
print(True == True and False)
# prints False

It can also help to put little tracers for specific variable like so:

print('GPA var is: {0}'.format(gpa))
# prints "GPA var is: (whatever the value is)"

Setting these tracers can be a powerful tool in writing strong code :slight_smile:!


Thank you very much :slight_smile:

1 Like