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
87 lines
2.1 KiB
Markdown
87 lines
2.1 KiB
Markdown
---
|
|
id: 69f35a5bb823ed620fcb7cba
|
|
title: "Challenge 281: Bingo Range"
|
|
challengeType: 29
|
|
dashedName: challenge-281
|
|
---
|
|
|
|
# --description--
|
|
|
|
Given a bingo letter, return the number range associated with that letter.
|
|
|
|
| Letter | Number Range |
|
|
| - | - |
|
|
| `"B"` | 1-15 |
|
|
| `"I"` | 16-30 |
|
|
| `"N"` | 31-45 |
|
|
| `"G"` | 46-60 |
|
|
| `"O"` | 61-75 |
|
|
|
|
Return an array with all numbers in the range from smallest to largest.
|
|
|
|
# --hints--
|
|
|
|
`get_bingo_range("B")` should return `[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]`.
|
|
|
|
```js
|
|
({test: () => { runPython(`
|
|
from unittest import TestCase
|
|
TestCase().assertEqual(get_bingo_range("B"), [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15])`)
|
|
}})
|
|
```
|
|
|
|
`get_bingo_range("I")` should return `[16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]`.
|
|
|
|
```js
|
|
({test: () => { runPython(`
|
|
from unittest import TestCase
|
|
TestCase().assertEqual(get_bingo_range("I"), [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30])`)
|
|
}})
|
|
```
|
|
|
|
`get_bingo_range("N")` should return `[31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45]`.
|
|
|
|
```js
|
|
({test: () => { runPython(`
|
|
from unittest import TestCase
|
|
TestCase().assertEqual(get_bingo_range("N"), [31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45])`)
|
|
}})
|
|
```
|
|
|
|
`get_bingo_range("G")` should return `[46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60]`.
|
|
|
|
```js
|
|
({test: () => { runPython(`
|
|
from unittest import TestCase
|
|
TestCase().assertEqual(get_bingo_range("G"), [46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60])`)
|
|
}})
|
|
```
|
|
|
|
`get_bingo_range("O")` should return `[61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75]`.
|
|
|
|
```js
|
|
({test: () => { runPython(`
|
|
from unittest import TestCase
|
|
TestCase().assertEqual(get_bingo_range("O"), [61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75])`)
|
|
}})
|
|
```
|
|
|
|
# --seed--
|
|
|
|
## --seed-contents--
|
|
|
|
```py
|
|
def get_bingo_range(letter):
|
|
|
|
return letter
|
|
```
|
|
|
|
# --solutions--
|
|
|
|
```py
|
|
def get_bingo_range(letter):
|
|
ranges = {"B": (1, 15), "I": (16, 30), "N": (31, 45), "G": (46, 60), "O": (61, 75)}
|
|
start, end = ranges[letter]
|
|
return list(range(start, end + 1))
|
|
```
|