[Python] Checking if first letter of string is in uppercase

Discussão em 'Python' iniciado por Stack, Agosto 16, 2025.

  1. Stack

    Stack Membro Participativo

    I want to create a function that would check if first letter of string is in uppercase. This is what I've came up with so far:

    def is_lowercase(word):
    if word[0] in range string.ascii_lowercase:
    return True
    else:
    return False


    When I try to run it I get this error:

    if word[0] in range string.ascii_lowercase
    ^
    SyntaxError: invalid syntax


    Can someone have a look and advise what I'm doing wrong?

    Continue reading...

Compartilhe esta Página