Python Online Compiler
Example: Python program to check whether a character is alphabet or not using conditional operator
C
C++
C#
Java
Python
PHP
main.py
STDIN
Run
# Python program to check whether a character is alphabet or not using conditional operator print ("Enter a character to check itself: ", end="") char, flag = str (input ())[0], False flag = True if (char >= 'a' and char <= 'z') or (char >= 'A' and char <= 'Z') else False if flag: print (char, "is an alphabet character.") else: print (char, "is not an alphabet character.")
K
Output
Clear
ADVERTISEMENTS