Mirroring Text

What happens if we add the letter to both sides of the new string that we’re making?

Try changing the phrase and see what effects you can generate.

The accumulator doesn’t have to be set to be an empty string. You can put something in the accumulator, and then it will show up in the middle of the mirrored phrase.

Activity: CodeLens 3 (Char_In_Middle)

<p>The phrase <code>”A but tuba”</code> is a <b>palindrome</b>. The letters are the same forward and backward. The below program generates the output: <code>”abut tub a<=>a but tuba”</code> Put the lines in the right order with the right indentation.</p>

        newStr = "<=>"
phrase = "a but tuba"
---
for char in phrase:
---
    newStr = char + newStr + char
---
print(newStr)
        
You have attempted of activities on this page