Solution 1

def convert_pirate_to_dog(pirate_saying):
    result_in_dog_speak = ""
    for letter in pirate_saying:
        result_in_dog_speak += letter
        result_in_dog_speak += "oo"
    return result_in_dog_speak

Convert Pirate to Dog

Today we're going to write a function to convert what a pirate would say into the way a dog would say it. Roo roo roo roo!

Complete the function convert_pirate_to_dog with a for loop so that it goes through each letter of pirate_saying and then adds 'oo' after each letter.

Remember that strings are immutable, so you will have to create a new string for the result of how a dog would sound.

Examples:

>>>  convert_pirate_to_dog("arrrr")
'aoorooroorooroo'

Hint: To add letters to the result string, use the += operator.

Test Cases

test pirate to dog - Run Test

def test_pirate_to_dog():
    assert convert_pirate_to_dog("arrrr") == "aoorooroorooroo"
def convert_pirate_to_dog(pirate_saying): pass