can the community help me as i am new to python coding
The question isn't related to PyCharm. It's better to post such questions on Python-related forums.
In your example, is_male is a string, not boolean, which is why you can check if it's True or False.
For example, check with if is_male == "True":