Python else Keyword

Used in conditional statements. When all other conditions are false, the code block defined by the else keyword is executed.

Example

Python
for c in 'A1-B2':
    if c.isalpha():
        print(f'{c} is a letter')
    elif c.isdigit():
        print(f'{c} is a number')
    else: 
        print(f'{c} is a something else')

Output

A is a letter
1 is a number
- is a something else
B is a letter
2 is a number