+ 4
Why this code execute male.
sex=('f') if(sex=='M' or 'm'): print('male') else: print('female') output=male #but why can you explain me.
2 odpowiedzi
+ 7
or 'm' is True, should be
...
if(sex =='M' or sex=='m'):
...
+ 1
print (sex=='M')
print ((sex=='M') or 'm')
try to print like above and if atatment will exscute for any value other than zero.
below code also prints male.
if('m'):
print('male')
else:
print('female')