python - Function that has if statement produces nothing when it's called -


#4 gender differences def d_gender(employee1, employee2):     if employee1.gender >= employee2.gender :         1     else :         0  d_gender(e1,e2) 

although defined function doesn't produce anything. wrong here?

you need return statement in function:

def d_gender(teacher, studio):     if teacher.gender >= studio.gender :         return 1     else :         return 0 

then can decide returned value. maybe print:

print(d_gender(t1,s1)) 

Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -