---
id: 69b58ce40693f140c84c855b
title: "Challenge 242: Next Bingo Number"
challengeType: 29
dashedName: challenge-242
---

# --description--

Given a bingo number, return the next bingo number sequentially.

A bingo number is a single letter followed by a number in its range according to this chart:

| Letter | Number Range |
| - | - |
| `"B"` | 1-15 |
| `"I"` | 16-30 |
| `"N"` | 31-45 |
| `"G"` | 46-60 |
| `"O"` | 61-75 |

For example, given `"B10"`, return `"B11"`, the next bingo number. If given the last bingo number, return `"B1"`.

# --hints--

`get_next_bingo_number("B10")` should return `"B11"`.

```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_next_bingo_number("B10"), "B11")`)
}})
```

`get_next_bingo_number("N33")` should return `"N34"`.

```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_next_bingo_number("N33"), "N34")`)
}})
```

`get_next_bingo_number("I30")` should return `"N31"`.

```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_next_bingo_number("I30"), "N31")`)
}})
```

`get_next_bingo_number("G60")` should return `"O61"`.

```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_next_bingo_number("G60"), "O61")`)
}})
```

`get_next_bingo_number("O75")` should return `"B1"`.

```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_next_bingo_number("O75"), "B1")`)
}})
```

# --seed--

## --seed-contents--

```py
def get_next_bingo_number(n):

    return n
```

# --solutions--

```py
def get_next_bingo_number(n):
    num = int(n[1:])
    next_num = 1 if num == 75 else num + 1

    if next_num <= 15:
        return "B" + str(next_num)
    if next_num <= 30:
        return "I" + str(next_num)
    if next_num <= 45:
        return "N" + str(next_num)
    if next_num <= 60:
        return "G" + str(next_num)
    return "O" + str(next_num)
```
