Boolean Check Functions in Python
Level 3126 keystrokes
This demonstrates isalpha() and isalnum() string methods. They check if characters are alphabetic or alphanumeric.
Python code
# The space would make both checks return False1text = "Hello World"# replace(' ', '') removes the space, giving "HelloWorld"# isalpha() is True because every character is a letter2print(f"isalpha: {text.replace(' ', '').isalpha()}")# isalnum() accepts letters and digits, so letters alone also give True3print(f"isalnum: {text.replace(' ', '').isalnum()}")Output
isalpha: True isalnum: True
Practice typing this code. Results are not recorded in the rankings.
Symbols in this code
The symbols you type in this Python code and how often they appear.
'× 8"× 6(× 6)× 6.× 4,× 2:× 2{× 2}× 2=× 1