Files
freecodecamp--freecodecamp/curriculum/challenges/english/blocks/daily-coding-challenges-python/69738771fb5a7b8b24cca2a3.md
T
wehub-resource-sync dde272c4b8
i18n - Build Validation / Validate i18n Builds (24) (push) Has been cancelled
CI - Node.js / Lint (24) (push) Has been cancelled
CI - Node.js / Build (24) (push) Has been cancelled
CI - Node.js / Test (24) (push) Has been cancelled
CI - Node.js / Test - Upcoming Changes (24) (push) Has been cancelled
CI - Node.js / Test - i18n (italian, 24) (push) Has been cancelled
CI - Node.js / Test - i18n (portuguese, 24) (push) Has been cancelled
CD - Docker - GHCR Images / Build and Push Images (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 11:55:53 +08:00

1.3 KiB

id, title, challengeType, dashedName
id title challengeType dashedName
69738771fb5a7b8b24cca2a3 Challenge 177: String Mirror 29 challenge-177

--description--

Given a string, return a new string that consists of the given string with a reversed copy of itself appended to the end of it.

--hints--

mirror("freeCodeCamp") should return "freeCodeCamppmaCedoCeerf".

({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(mirror("freeCodeCamp"), "freeCodeCamppmaCedoCeerf")`)
}})

mirror("RaceCar") should return "RaceCarraCecaR".

({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(mirror("RaceCar"), "RaceCarraCecaR")`)
}})

mirror("helloworld") should return "helloworlddlrowolleh".

({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(mirror("helloworld"), "helloworlddlrowolleh")`)
}})

mirror("The quick brown fox...") should return "The quick brown fox......xof nworb kciuq ehT".

({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(mirror("The quick brown fox..."), "The quick brown fox......xof nworb kciuq ehT")`)
}})

--seed--

--seed-contents--

def mirror(s):

    return s

--solutions--

def mirror(s):
    reversed_s = s[::-1]
    return s + reversed_s