Python Doubt | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson

Python Doubt

I was doing some experiements while writing a code. To my surprise I found something strange result. I know the code is wrong but it was just my curiosity to experiement it.

5th Jan 2022, 5:55 PM
3 Answers
+ 2
Your code is not wrong. In Python functions are objects, so you are able to print them. So you see the name and the memory address of isalnum() For more details you can read this article:
5th Jan 2022, 6:15 PM
Denise Roßberg
Denise Roßberg - avatar
+ 1
If you are looking for the value True or False don't forget to add ( ) to your method. print(name.isalnum()) will return True
5th Jan 2022, 9:03 PM
What's the problem ? It's a function object, executed with parentheses name="kartik" print(name.isalnum) help(name.isalnum) print("\n".join([x for x in dir(name)]))
5th Jan 2022, 6:16 PM
FanYu - avatar