Skip to content

e07b1_capital.py do not check if the first character is a vowel and uppercase #13

Description

@khoi-thinh

As a result, if the word we check is: Octopus, then output should be Uboctubopubus, not Octubopubus.
I think the code can be something like this.

def ubbi_dubbi(string):
    output = []
    if string[0].lower() in "aiueo":
        result = f'ub{string[0]}'
    else:
        result = f'{string[0]}'   

    if string[0].isupper():
        output.append(result.capitalize())
    else:
        output.append(result)    

    for each in string[1:]:
        if each in "aiueo":
            output.append(f'ub{each}')
        else:
            output.append(each)    
    return ''.join(output)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions