Python Int And Str | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Python Int And Str

odd=2 if odd==int: print('worked') elif odd==str: print('phew') else: print('fail') Results=fail How Can I Change The Results To worked

11th Apr 2017, 5:07 PM
Nihad TK
Nihad TK - avatar
2 Answers
+ 1
i think, you need to use if type(odd)==int: elif type(odd)==str:
11th Apr 2017, 6:11 PM
Stanislav Svetlov
Stanislav Svetlov - avatar
+ 1
Thanks Very HelpFull
11th Apr 2017, 6:46 PM
Nihad TK
Nihad TK - avatar