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
105 lines
2.4 KiB
Markdown
105 lines
2.4 KiB
Markdown
---
|
|
id: 69c5f3d787b1725d5f00c8b7
|
|
title: "Challenge 253: Acronym Finder"
|
|
challengeType: 29
|
|
dashedName: challenge-253
|
|
---
|
|
|
|
# --description--
|
|
|
|
Given a string representing an acronym, return the full name of the organization it belongs to from the list below:
|
|
|
|
- `"National Avocado Storage Authority"`
|
|
- `"Cats Infiltration Agency"`
|
|
- `"Fluffy Beanbag Inspectors"`
|
|
- `"Department Of Jelly"`
|
|
- `"Wild Honey Organization"`
|
|
- `"Eating Pancakes Administration"`
|
|
|
|
Each letter in the given acronym should match the first letter of each word in the organization it belongs to, in the same order.
|
|
|
|
# --hints--
|
|
|
|
`find_org("NASA")` should return `"National Avocado Storage Authority"`.
|
|
|
|
```js
|
|
({test: () => { runPython(`
|
|
from unittest import TestCase
|
|
TestCase().assertEqual(find_org("NASA"), "National Avocado Storage Authority")`)
|
|
}})
|
|
```
|
|
|
|
`find_org("CIA")` should return `"Cats Infiltration Agency"`.
|
|
|
|
```js
|
|
({test: () => { runPython(`
|
|
from unittest import TestCase
|
|
TestCase().assertEqual(find_org("CIA"), "Cats Infiltration Agency")`)
|
|
}})
|
|
```
|
|
|
|
`find_org("FBI")` should return `"Fluffy Beanbag Inspectors"`.
|
|
|
|
```js
|
|
({test: () => { runPython(`
|
|
from unittest import TestCase
|
|
TestCase().assertEqual(find_org("FBI"), "Fluffy Beanbag Inspectors")`)
|
|
}})
|
|
```
|
|
|
|
`find_org("DOJ")` should return `"Department Of Jelly"`.
|
|
|
|
```js
|
|
({test: () => { runPython(`
|
|
from unittest import TestCase
|
|
TestCase().assertEqual(find_org("DOJ"), "Department Of Jelly")`)
|
|
}})
|
|
```
|
|
|
|
`find_org("WHO")` should return `"Wild Honey Organization"`.
|
|
|
|
```js
|
|
({test: () => { runPython(`
|
|
from unittest import TestCase
|
|
TestCase().assertEqual(find_org("WHO"), "Wild Honey Organization")`)
|
|
}})
|
|
```
|
|
|
|
`find_org("EPA")` should return `"Eating Pancakes Administration"`.
|
|
|
|
```js
|
|
({test: () => { runPython(`
|
|
from unittest import TestCase
|
|
TestCase().assertEqual(find_org("EPA"), "Eating Pancakes Administration")`)
|
|
}})
|
|
```
|
|
|
|
# --seed--
|
|
|
|
## --seed-contents--
|
|
|
|
```py
|
|
def find_org(acronym):
|
|
|
|
return acronym
|
|
```
|
|
|
|
# --solutions--
|
|
|
|
```py
|
|
def find_org(acronym):
|
|
orgs = [
|
|
"National Avocado Storage Authority",
|
|
"Cats Infiltration Agency",
|
|
"Fluffy Beanbag Inspectors",
|
|
"Department Of Jelly",
|
|
"Wild Honey Organization",
|
|
"Eating Pancakes Administration",
|
|
]
|
|
for org in orgs:
|
|
initials = ''.join(word[0] for word in org.split())
|
|
if initials.upper() == acronym.upper():
|
|
return org
|
|
return "not found"
|
|
```
|