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
67 lines
1.3 KiB
Markdown
67 lines
1.3 KiB
Markdown
---
|
|
id: 69738771fb5a7b8b24cca2a3
|
|
title: "Challenge 177: String Mirror"
|
|
challengeType: 29
|
|
dashedName: 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"`.
|
|
|
|
```js
|
|
({test: () => { runPython(`
|
|
from unittest import TestCase
|
|
TestCase().assertEqual(mirror("freeCodeCamp"), "freeCodeCamppmaCedoCeerf")`)
|
|
}})
|
|
```
|
|
|
|
`mirror("RaceCar")` should return `"RaceCarraCecaR"`.
|
|
|
|
```js
|
|
({test: () => { runPython(`
|
|
from unittest import TestCase
|
|
TestCase().assertEqual(mirror("RaceCar"), "RaceCarraCecaR")`)
|
|
}})
|
|
```
|
|
|
|
`mirror("helloworld")` should return `"helloworlddlrowolleh"`.
|
|
|
|
```js
|
|
({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"`.
|
|
|
|
```js
|
|
({test: () => { runPython(`
|
|
from unittest import TestCase
|
|
TestCase().assertEqual(mirror("The quick brown fox..."), "The quick brown fox......xof nworb kciuq ehT")`)
|
|
}})
|
|
```
|
|
|
|
# --seed--
|
|
|
|
## --seed-contents--
|
|
|
|
```py
|
|
def mirror(s):
|
|
|
|
return s
|
|
```
|
|
|
|
# --solutions--
|
|
|
|
```py
|
|
def mirror(s):
|
|
reversed_s = s[::-1]
|
|
return s + reversed_s
|
|
```
|