Skip to content

Commit

Permalink
[Making the Grade]: Modified Test Error Messages & Touched Up Docs (#…
Browse files Browse the repository at this point in the history
…3542)

* Updated test error messages and touched up docs.
* Removed deep copy from imports, as it was unneeded.
[no important files changed]
  • Loading branch information
BethanyG authored Nov 7, 2023
1 parent 2e407c7 commit c5bfa4c
Show file tree
Hide file tree
Showing 5 changed files with 157 additions and 101 deletions.
14 changes: 7 additions & 7 deletions concepts/loops/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,17 +235,17 @@ The loop [`else` clause][loop else] is unique to Python and can be used for "wra
'Found an S, stopping iteration.'
```

[loop else]: https://docs.python.org/3/tutorial/controlflow.html#break-and-continue-statements-and-else-clauses-on-loops
[range]: https://docs.python.org/3/library/stdtypes.html#range
[break statement]: https://docs.python.org/3/reference/simple_stmts.html#the-break-statement
[common sequence operations]: https://docs.python.org/3/library/stdtypes.html#common-sequence-operations
[continue statement]: https://docs.python.org/3/reference/simple_stmts.html#the-continue-statement
[while statement]: https://docs.python.org/3/reference/compound_stmts.html#the-while-statement
[truth value testing]: https://docs.python.org/3/library/stdtypes.html#truth-value-testing
[enumerate]: https://docs.python.org/3/library/functions.html#enumerate
[iterator]: https://docs.python.org/3/glossary.html#term-iterator
[common sequence operations]: https://docs.python.org/3/library/stdtypes.html#common-sequence-operations
[range is not an iterator]: https://treyhunner.com/2018/02/python-range-is-not-an-iterator/
[for statement]: https://docs.python.org/3/reference/compound_stmts.html#for
[iterable]: https://docs.python.org/3/glossary.html#term-iterable
[iterator]: https://docs.python.org/3/glossary.html#term-iterator
[loop else]: https://docs.python.org/3/tutorial/controlflow.html#break-and-continue-statements-and-else-clauses-on-loops
[next built-in]: https://docs.python.org/3/library/functions.html#next
[range is not an iterator]: https://treyhunner.com/2018/02/python-range-is-not-an-iterator/
[range]: https://docs.python.org/3/library/stdtypes.html#range
[stopiteration]: https://docs.python.org/3/library/exceptions.html#StopIteration
[truth value testing]: https://docs.python.org/3/library/stdtypes.html#truth-value-testing
[while statement]: https://docs.python.org/3/reference/compound_stmts.html#the-while-statement
20 changes: 11 additions & 9 deletions exercises/concept/making-the-grade/.docs/hints.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

## General

- `while` loops are used for _indefinite_ (uncounted) iteration
- `for` loops are used for _definite_, (counted) iteration.
- The keywords `break` and `continue` help customize loop behavior.
- `range(<start>, stop, <step>)` can be used to generate a sequence for a loop counter.
- The built-in `enumerate()` will return (`<value>`, `<index>`) pairs to iterate over.
- [`while`][while-loops] loops are used for _indefinite_ (uncounted) iteration
- [`for`][for-loops] loops are used for _definite_, (counted) iteration.
- The keywords [`break` and `continue`][control flow] help customize loop behavior.
- [`range(<start>, stop, <step>)`][range] can be used to generate a sequence for a loop counter.
- The built-in [`enumerate()`][enumerate] will return (`<value>`, `<index>`) pairs to iterate over.

Also being familiar with the following can help with completing the tasks:

Expand Down Expand Up @@ -47,11 +47,13 @@ Also being familiar with the following can help with completing the tasks:
- There may be or may not be a student with a score of 100, and you can't return `[]` without checking **all** scores.
- The [`control flow`][control flow] statements `continue` and `break` may be useful here to move past unwanted values.

[list]: https://docs.python.org/3/library/stdtypes.html#list
[str]: https://docs.python.org/3/library/stdtypes.html#str
[f-strings]: https://docs.python.org/3/reference/lexical_analysis.html#formatted-string-literals
[append and pop]: https://docs.python.org/3/tutorial/datastructures.html#more-on-lists
[enumerate]: https://docs.python.org/3/library/functions.html#enumerate
[control flow]: https://docs.python.org/3/tutorial/controlflow.html#break-and-continue-statements-and-else-clauses-on-loops
[enumerate]: https://docs.python.org/3/library/functions.html#enumerate
[f-strings]: https://docs.python.org/3/reference/lexical_analysis.html#formatted-string-literals
[for-loops]: https://docs.python.org/3/tutorial/controlflow.html#for-statements
[list]: https://docs.python.org/3/library/stdtypes.html#list
[range]: https://docs.python.org/3/tutorial/controlflow.html#the-range-function
[round]: https://docs.python.org/3/library/functions.html#round
[str]: https://docs.python.org/3/library/stdtypes.html#str
[while-loops]: https://docs.python.org/3/reference/compound_stmts.html#the-while-statement
17 changes: 9 additions & 8 deletions exercises/concept/making-the-grade/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ You decide to make things a little more interesting by putting together some fun
While you can give "partial credit" on exam questions, overall exam scores have to be `int`s.
So before you can do anything else with the class scores, you need to go through the grades and turn any `float` scores into `int`s. Lucky for you, Python has the built-in [`round()`][round] function you can use.

Create the function `round_scores()` that takes a `list` of `student_scores`.
Create the function `round_scores(student_scores)` that takes a `list` of `student_scores`.
This function should _consume_ the input `list` and `return` a new list with all the scores converted to `int`s.
The order of the scores in the resulting `list` is not important.

Expand All @@ -22,10 +22,10 @@ The order of the scores in the resulting `list` is not important.

## 2. Non-Passing Students

As you were grading the exam, you noticed some students weren't performing as well as you'd hoped.
As you were grading the exam, you noticed some students weren't performing as well as you had hoped.
But you were distracted, and forgot to note exactly _how many_ students.

Create the function `count_failed_students()` that takes a `list` of `student_scores`.
Create the function `count_failed_students(student_scores)` that takes a `list` of `student_scores`.
This function should count up the number of students who don't have passing scores and return that count as an integer.
A student needs a score greater than **40** to achieve a passing grade on the exam.

Expand All @@ -39,7 +39,7 @@ A student needs a score greater than **40** to achieve a passing grade on the ex
The teacher you're assisting wants to find the group of students who've performed "the best" on this exam.
What qualifies as "the best" fluctuates, so you need to find the student scores that are **greater than or equal to** the current threshold.

Create the function `above_threshold()` taking `student_scores` (a `list` of grades), and `threshold` (the "top score" threshold) as parameters.
Create the function `above_threshold(student_scores)` taking `student_scores` (a `list` of grades), and `threshold` (the "top score" threshold) as parameters.
This function should return a `list` of all scores that are `>=` to `threshold`.

```python
Expand All @@ -49,10 +49,11 @@ This function should return a `list` of all scores that are `>=` to `threshold`.

## 4. Calculating Letter Grades

The teacher you're assisting likes to assign letter grades as well as numeric scores.
The teacher you are assisting likes to assign letter grades as well as numeric scores.
Since students rarely score 100 on an exam, the "letter grade" lower thresholds are calculated based on the highest score achieved, and increment evenly between the high score and the failing threshold of **<= 40**.

Create the function `letter_grades()` that takes the "highest" score on the exam as a parameter, and returns a `list` of lower score thresholds for each "American style" grade interval: `["D", "C", "B", "A"]`.
Create the function `letter_grades(highest)` that takes the "highest" score on the exam as an argument, and returns a `list` of lower score thresholds for each "American style" grade interval: `["D", "C", "B", "A"]`.


```python
"""Where the highest score is 100, and failing is <= 40.
Expand Down Expand Up @@ -84,7 +85,7 @@ Create the function `letter_grades()` that takes the "highest" score on the exam
You have a list of exam scores in descending order, and another list of student names also sorted in descending order by their exam scores.
You would like to match each student name with their exam score and print out an overall class ranking.

Create the function `student_ranking()` with parameters `student_scores` and `student_names`.
Create the function `student_ranking(student_scores)` with parameters `student_scores` and `student_names`.
Match each student name on the student_names `list` with their score from the student_scores `list`.
You can assume each argument `list` will be sorted from highest score(er) to lowest score(er).
The function should return a `list` of strings with the format `<rank>. <student name>: <student score>`.
Expand All @@ -101,7 +102,7 @@ The function should return a `list` of strings with the format `<rank>. <student

Although a "perfect" score of 100 is rare on an exam, it is interesting to know if at least one student has achieved it.

Create the function `perfect_score()` with parameter `student_info`.
Create the function `perfect_score(student_info)` with parameter `student_info`.
`student_info` is a `list` of lists containing the name and score of each student: `[["Charles", 90], ["Tony", 80]]`.
The function should `return` _the first_ `[<name>, <score>]` pair of the student who scored 100 on the exam.

Expand Down
12 changes: 6 additions & 6 deletions exercises/concept/making-the-grade/.docs/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,13 @@ The [`break`][break statement] (_like in many C-related languages_) keyword can
'loop broken.'
```

[for statement]: https://docs.python.org/3/reference/compound_stmts.html#for
[range]: https://docs.python.org/3/library/stdtypes.html#range
[break statement]: https://docs.python.org/3/reference/simple_stmts.html#the-break-statement
[common sequence operations]: https://docs.python.org/3/library/stdtypes.html#common-sequence-operations
[continue statement]: https://docs.python.org/3/reference/simple_stmts.html#the-continue-statement
[while statement]: https://docs.python.org/3/reference/compound_stmts.html#the-while-statement
[iterable]: https://docs.python.org/3/glossary.html#term-iterable
[truth value testing]: https://docs.python.org/3/library/stdtypes.html#truth-value-testing
[enumerate]: https://docs.python.org/3/library/functions.html#enumerate
[common sequence operations]: https://docs.python.org/3/library/stdtypes.html#common-sequence-operations
[for statement]: https://docs.python.org/3/reference/compound_stmts.html#for
[iterable]: https://docs.python.org/3/glossary.html#term-iterable
[next built-in]: https://docs.python.org/3/library/functions.html#next
[range]: https://docs.python.org/3/library/stdtypes.html#range
[truth value testing]: https://docs.python.org/3/library/stdtypes.html#truth-value-testing
[while statement]: https://docs.python.org/3/reference/compound_stmts.html#the-while-statement
Loading

0 comments on commit c5bfa4c

Please sign in to comment.