Files
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

81 lines
1.6 KiB
Markdown

---
id: 69bc6cb30c1d112a2e110a03
title: "Challenge 246: Name Initials"
challengeType: 29
dashedName: challenge-246
---
# --description--
Given a full name as a string, return their initials.
- Names to initialize are separated by a space.
- Initials should be made uppercase.
- Initials should be separated by dots.
For example, `"Tommy Millwood"` returns `"T.M."`.
# --hints--
`get_initials("Tommy Millwood")` should return `"T.M."`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_initials("Tommy Millwood"), "T.M.")`)
}})
```
`get_initials("Savanna Puddlesplash")` should return `"S.P."`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_initials("Savanna Puddlesplash"), "S.P.")`)
}})
```
`get_initials("Frances Cowell Conrad")` should return `"F.C.C."`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_initials("Frances Cowell Conrad"), "F.C.C.")`)
}})
```
`get_initials("Dragon")` should return `"D."`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_initials("Dragon"), "D.")`)
}})
```
`get_initials("Dorothy Vera Clump Haverstock Norris")` should return `"D.V.C.H.N."`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_initials("Dorothy Vera Clump Haverstock Norris"), "D.V.C.H.N.")`)
}})
```
# --seed--
## --seed-contents--
```py
def get_initials(name):
return name
```
# --solutions--
```py
def get_initials(name):
return ''.join(word[0].upper() + '.' for word in name.split())
```