Files
freecodecamp--freecodecamp/curriculum/challenges/english/blocks/daily-coding-challenges-python/697a49e9860d24853adef67c.md
T
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

147 lines
3.5 KiB
Markdown

---
id: 697a49e9860d24853adef67c
title: "Challenge 191: 2026 Winter Games Day 12: Bobsled"
challengeType: 29
dashedName: challenge-191
---
# --description--
Given an array representing the weights of the athletes on a bobsled team and a number representing the weight of the bobsled, determine whether the team is eligible to race.
- The length of the array determines the team size: 1, 2 or 4 person teams.
- All given weight values are in kilograms (kg).
The bobsled (sled by itself) must have a minimum weight of:
- 162 kg for a 1-person team
- 170 kg for a 2-person team
- 210 kg for a 4-person team
The total weight of the bobsled (athletes plus sled) must not exceed:
- 247 kg for a 1-person team
- 390 kg for a 2-person team
- 630 kg for a 4-person team
Return `"Eligible"` if the team meets all the requirements, or `"Not Eligible"` if the team fails to meet one or more of the requirements.
# --hints--
`check_eligibility([78], 165)` should return `"Eligible"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(check_eligibility([78], 165), "Eligible")`)
}})
```
`check_eligibility([80], 160)` should return `"Not Eligible"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(check_eligibility([80], 160), "Not Eligible")`)
}})
```
`check_eligibility([80], 170)` should return `"Not Eligible"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(check_eligibility([80], 170), "Not Eligible")`)
}})
```
`check_eligibility([85, 90], 170)` should return `"Eligible"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(check_eligibility([85, 90], 170), "Eligible")`)
}})
```
`check_eligibility([85, 95], 168)` should return `"Not Eligible"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(check_eligibility([85, 95], 168), "Not Eligible")`)
}})
```
`check_eligibility([112, 97], 185)` should return `"Not Eligible"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(check_eligibility([112, 97], 185), "Not Eligible")`)
}})
```
`check_eligibility([110, 102, 90, 106], 222)` should return `"Eligible"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(check_eligibility([110, 102, 90, 106], 222), "Eligible")`)
}})
```
`check_eligibility([106, 99, 90, 88], 205)` should return `"Not Eligible"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(check_eligibility([106, 99, 90, 88], 205), "Not Eligible")`)
}})
```
`check_eligibility([106, 99, 103, 96], 227)` should return `"Not Eligible"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(check_eligibility([106, 99, 103, 96], 227), "Not Eligible")`)
}})
```
# --seed--
## --seed-contents--
```py
def check_eligibility(athlete_weights, sled_weight):
return athlete_weights
```
# --solutions--
```py
def check_eligibility(athlete_weights, sled_weight):
team_size = len(athlete_weights)
rules = {
1: {"min_sled": 162, "max_total": 247},
2: {"min_sled": 170, "max_total": 390},
4: {"min_sled": 210, "max_total": 630}
}
min_sled = rules[team_size]["min_sled"]
max_total = rules[team_size]["max_total"]
total_weight = sum(athlete_weights) + sled_weight
if sled_weight < min_sled:
return "Not Eligible"
if total_weight > max_total:
return "Not Eligible"
return "Eligible"
```