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
79 lines
1.8 KiB
Markdown
79 lines
1.8 KiB
Markdown
---
|
|
id: 681cb1afdab50c87ddb2e515
|
|
title: "Challenge 4: S P A C E J A M"
|
|
challengeType: 29
|
|
dashedName: challenge-4
|
|
---
|
|
|
|
# --description--
|
|
|
|
Given a string, remove all spaces from the string, insert two spaces between every character, convert all alphabetical letters to uppercase, and return the result.
|
|
|
|
- Non-alphabetical characters should remain unchanged (except for spaces).
|
|
|
|
# --hints--
|
|
|
|
`space_jam("freeCodeCamp")` should return `"F R E E C O D E C A M P"`.
|
|
|
|
```js
|
|
({test: () => { runPython(`
|
|
from unittest import TestCase
|
|
TestCase().assertEqual(space_jam("freeCodeCamp"), "F R E E C O D E C A M P")`)
|
|
}})
|
|
```
|
|
|
|
`space_jam(" free Code Camp ")` should return `"F R E E C O D E C A M P"`.
|
|
|
|
```js
|
|
({test: () => { runPython(`
|
|
from unittest import TestCase
|
|
TestCase().assertEqual(space_jam(" free Code Camp "), "F R E E C O D E C A M P")`)
|
|
}})
|
|
```
|
|
|
|
`space_jam("Hello World?!")` should return `"H E L L O W O R L D ? !"`.
|
|
|
|
```js
|
|
({test: () => { runPython(`
|
|
from unittest import TestCase
|
|
TestCase().assertEqual(space_jam("Hello World?!"), "H E L L O W O R L D ? !")`)
|
|
}})
|
|
```
|
|
|
|
`space_jam("C@t$ & D0g$")` should return `"C @ T $ & D 0 G $"`.
|
|
|
|
```js
|
|
({test: () => { runPython(`
|
|
from unittest import TestCase
|
|
TestCase().assertEqual(space_jam("C@t$ & D0g$"), "C @ T $ & D 0 G $")`)
|
|
}})
|
|
```
|
|
|
|
`space_jam("allyourbase")` should return `"A L L Y O U R B A S E"`.
|
|
|
|
```js
|
|
({test: () => { runPython(`
|
|
from unittest import TestCase
|
|
TestCase().assertEqual(space_jam("all your base"), "A L L Y O U R B A S E")`)
|
|
}})
|
|
```
|
|
|
|
# --seed--
|
|
|
|
## --seed-contents--
|
|
|
|
```py
|
|
def space_jam(s):
|
|
|
|
return s
|
|
```
|
|
|
|
# --solutions--
|
|
|
|
```py
|
|
def space_jam(s):
|
|
s = s.replace(" ", "")
|
|
s = " ".join(s)
|
|
return s.upper()
|
|
```
|