def same_ranks(ranks):
    """
    Return `True` if the cards in a list of ranks are all of the same
    rank, false otherwise. Ignore the last character of the cards
    because this specifies their suit.
    """

    ranks_set = set()
    for card in ranks:
        ranks_set.add(card[:-1])

    set_len = len(ranks_set)
    return set_len == 1 or set_len == 0