Skip to content

e05b2_punctuation.py do not return the correct result #10

@khoi-thinh

Description

@khoi-thinh

When I tested with 2 words "python" and "air", the result was:

"ythonpay"
"iraay" (this is not correct, it should output airway)

I think the code should be like this

    if word[0].lower() in 'aeiou':
        output = f'{word}way'
        return output + punctuation

    output = f'{word[1:]}{word[0]}ay'
    return output + punctuation 

or

    if word[0].lower() in 'aeiou':
        output = f'{word}way'
    else:    
        output = f'{word[1:]}{word[0]}ay'

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