Skip to content

Latest commit

 

History

History
17 lines (12 loc) · 319 Bytes

letter_start.md

File metadata and controls

17 lines (12 loc) · 319 Bytes

Start with a Letter

  1. How to check if a string starts with a letter?

Solution

# Regex based solution
import re
if re.match("^[a-zA-Z]+.*", string):
    print("yay, it starts with a letter")

# Built-in string method
if string and string[0].isalpha():
    print("yay, it starts with a letter")