Files
freeCodeCamp/curriculum/challenges/english/blocks/daily-coding-challenges-python/69f35a5bb823ed620fcb7cba.md
T

2.1 KiB

id, title, challengeType, dashedName
id title challengeType dashedName
69f35a5bb823ed620fcb7cba Challenge 281: Bingo Range 29 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].

({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].

({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].

({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].

({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].

({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--

def get_bingo_range(letter):

    return letter

--solutions--

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))