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
81 lines
1.9 KiB
Markdown
81 lines
1.9 KiB
Markdown
---
|
|
id: 69a890af247de743333bd4cf
|
|
title: "Challenge 226: Passing Exam Count"
|
|
challengeType: 29
|
|
dashedName: challenge-226
|
|
---
|
|
|
|
# --description--
|
|
|
|
Given an array of student exam scores and the score needed to pass it, return the number of students that passed the exam.
|
|
|
|
# --hints--
|
|
|
|
`passing_count([90, 85, 75, 60, 50], 70)` should return `3`.
|
|
|
|
```js
|
|
({test: () => { runPython(`
|
|
from unittest import TestCase
|
|
TestCase().assertEqual(passing_count([90, 85, 75, 60, 50], 70), 3)`)
|
|
}})
|
|
```
|
|
|
|
`passing_count([100, 80, 75, 88, 72, 74, 79, 71, 60, 92], 75)` should return `6`.
|
|
|
|
```js
|
|
({test: () => { runPython(`
|
|
from unittest import TestCase
|
|
TestCase().assertEqual(passing_count([100, 80, 75, 88, 72, 74, 79, 71, 60, 92], 75), 6)`)
|
|
}})
|
|
```
|
|
|
|
`passing_count([79, 60, 88, 72, 74, 59, 75, 71, 80, 92], 60)` should return `9`.
|
|
|
|
```js
|
|
({test: () => { runPython(`
|
|
from unittest import TestCase
|
|
TestCase().assertEqual(passing_count([79, 60, 88, 72, 74, 59, 75, 71, 80, 92], 60), 9)`)
|
|
}})
|
|
```
|
|
|
|
`passing_count([76, 79, 80, 70, 71, 65, 79, 78, 59, 72], 85)` should return `0`.
|
|
|
|
```js
|
|
({test: () => { runPython(`
|
|
from unittest import TestCase
|
|
TestCase().assertEqual(passing_count([76, 79, 80, 70, 71, 65, 79, 78, 59, 72], 85), 0)`)
|
|
}})
|
|
```
|
|
|
|
`passing_count([84, 65, 98, 53, 58, 71, 91, 80, 92, 70, 73, 83, 86, 69, 84, 77, 72, 58, 69, 75, 66, 68, 72, 96, 90, 63, 88, 63, 80, 67], 60)` should return `27`.
|
|
|
|
```js
|
|
({test: () => { runPython(`
|
|
from unittest import TestCase
|
|
TestCase().assertEqual(passing_count([84, 65, 98, 53, 58, 71, 91, 80, 92, 70, 73, 83, 86, 69, 84, 77, 72, 58, 69, 75, 66, 68, 72, 96, 90, 63, 88, 63, 80, 67], 60), 27)`)
|
|
}})
|
|
```
|
|
|
|
# --seed--
|
|
|
|
## --seed-contents--
|
|
|
|
```py
|
|
def passing_count(scores, passing_score):
|
|
|
|
return scores
|
|
```
|
|
|
|
# --solutions--
|
|
|
|
```py
|
|
def passing_count(scores, passing_score):
|
|
count = 0
|
|
|
|
for score in scores:
|
|
if score >= passing_score:
|
|
count += 1
|
|
|
|
return count
|
|
```
|