From 9b9e5636b7f38ad4eff7e436f69625f4d96ae98d Mon Sep 17 00:00:00 2001 From: BethanyG Date: Tue, 5 Mar 2019 13:04:46 -0800 Subject: [PATCH 1/4] python/high-scores OOP HINTS OOP hints for High Scores. --- exercises/high-scores/.meta/HINTS.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 exercises/high-scores/.meta/HINTS.md diff --git a/exercises/high-scores/.meta/HINTS.md b/exercises/high-scores/.meta/HINTS.md new file mode 100644 index 00000000000..694b99be163 --- /dev/null +++ b/exercises/high-scores/.meta/HINTS.md @@ -0,0 +1,17 @@ +### Python and Object Oriented Programming (OOP) + + + +High Scores requires that you make a **class** in Python, so you need to be familiar with the basics of **Object Oriented Programming**. _Don't worry, it's not as complicated as you think it is!_ Here are some tutorials and links to get you up to speed: + + + +1) [**Object-Oriented Programming (OOP) in Python 3**](https://realpython.com/python3-object-oriented-programming/) from the Real Python website. Goes over all the definitions and mechanics step by step. Great for the absolute first-timer. + + + +2) [**Object-Oriented Programming in Python 3**](https://www.digitalocean.com/community/tutorial_series/object-oriented-programming-in-python-3) from Lisa Tagliaferri on the DigitalOcean community blog. This is more CS-language focused and covers both the introduction of classes and CS "theory" subjects like inheritance and polymorphism. Good for those who are coming to Python from another OOP language, or those who are "intermediate" level. + + + +3) [**A First Look at Classes**](https://docs.python.org/3/tutorial/classes.html#a-first-look-at-classes) from the Python 3 documentation. This is very well written and was compiled by the core maintainers of the Python programming language. It's very focused on how classes and methods execute "under the covers" and how the namespaces for classes are created and resolved. Good for those who are comfortable with reading technical documentation, talking about OOP, and looking at programming language internals. From 29b23afcd8c9a3da05295e35e4a0c69c58d04298 Mon Sep 17 00:00:00 2001 From: BethanyG Date: Wed, 6 Mar 2019 08:46:05 -0800 Subject: [PATCH 2/4] Update HINTS.md Re-ordered and swapped out links. --- exercises/high-scores/.meta/HINTS.md | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/exercises/high-scores/.meta/HINTS.md b/exercises/high-scores/.meta/HINTS.md index 694b99be163..c2a078455dd 100644 --- a/exercises/high-scores/.meta/HINTS.md +++ b/exercises/high-scores/.meta/HINTS.md @@ -1,17 +1,5 @@ -### Python and Object Oriented Programming (OOP) +In this exercise you're going to create a **class** and use lists to organize scores. _Don't worry, it's not as complicated as you think it is!_ - - -High Scores requires that you make a **class** in Python, so you need to be familiar with the basics of **Object Oriented Programming**. _Don't worry, it's not as complicated as you think it is!_ Here are some tutorials and links to get you up to speed: - - - -1) [**Object-Oriented Programming (OOP) in Python 3**](https://realpython.com/python3-object-oriented-programming/) from the Real Python website. Goes over all the definitions and mechanics step by step. Great for the absolute first-timer. - - - -2) [**Object-Oriented Programming in Python 3**](https://www.digitalocean.com/community/tutorial_series/object-oriented-programming-in-python-3) from Lisa Tagliaferri on the DigitalOcean community blog. This is more CS-language focused and covers both the introduction of classes and CS "theory" subjects like inheritance and polymorphism. Good for those who are coming to Python from another OOP language, or those who are "intermediate" level. - - - -3) [**A First Look at Classes**](https://docs.python.org/3/tutorial/classes.html#a-first-look-at-classes) from the Python 3 documentation. This is very well written and was compiled by the core maintainers of the Python programming language. It's very focused on how classes and methods execute "under the covers" and how the namespaces for classes are created and resolved. Good for those who are comfortable with reading technical documentation, talking about OOP, and looking at programming language internals. +- [**A First Look at Classes**](https://docs.python.org/3/tutorial/classes.html#a-first-look-at-classes) from the Python 3 documentation. +- [**How to Define a Class in Python**](https://realpython.com/python3-object-oriented-programming/#how-to-define-a-class-in-python) from the Real Python website. +- [**Data Structures in Python**](https://docs.python.org/3/tutorial/datastructures.html) from the Python 3 documentation. From bc47c738066016642ccb2a622c00282467422053 Mon Sep 17 00:00:00 2001 From: Ryan Potts Date: Wed, 6 Mar 2019 10:15:30 -0800 Subject: [PATCH 3/4] Update exercises/high-scores/.meta/HINTS.md Co-Authored-By: BethanyG --- exercises/high-scores/.meta/HINTS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/high-scores/.meta/HINTS.md b/exercises/high-scores/.meta/HINTS.md index c2a078455dd..d1d5af1196e 100644 --- a/exercises/high-scores/.meta/HINTS.md +++ b/exercises/high-scores/.meta/HINTS.md @@ -1,4 +1,4 @@ -In this exercise you're going to create a **class** and use lists to organize scores. _Don't worry, it's not as complicated as you think it is!_ +In this exercise you're going to create a **class** and use lists to organize scores. _Don't worry, it's not as complicated as you think!_ - [**A First Look at Classes**](https://docs.python.org/3/tutorial/classes.html#a-first-look-at-classes) from the Python 3 documentation. - [**How to Define a Class in Python**](https://realpython.com/python3-object-oriented-programming/#how-to-define-a-class-in-python) from the Real Python website. From e363805c791f65552b62fc087e16580bb4ce5878 Mon Sep 17 00:00:00 2001 From: Bethany Garcia Date: Thu, 4 Apr 2019 02:36:09 -0700 Subject: [PATCH 4/4] Ran configlet to re-generate README --- exercises/high-scores/README.md | 48 ++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 4 deletions(-) diff --git a/exercises/high-scores/README.md b/exercises/high-scores/README.md index 802ad5ac1ee..6b08db6eb92 100644 --- a/exercises/high-scores/README.md +++ b/exercises/high-scores/README.md @@ -4,19 +4,59 @@ Manage a game player's High Score list. Your task is to build a high-score component of the classic Frogger game, one of the highest selling and addictive games of all time, and a classic of the arcade era. Your task is to write methods that return the highest score from the list, the last added score and the three highest scores. -## Submitting Exercises +In this exercise you're going to create a **class** and use lists to organize scores. _Don't worry, it's not as complicated as you think!_ + +- [**A First Look at Classes**](https://docs.python.org/3/tutorial/classes.html#a-first-look-at-classes) from the Python 3 documentation. +- [**How to Define a Class in Python**](https://realpython.com/python3-object-oriented-programming/#how-to-define-a-class-in-python) from the Real Python website. +- [**Data Structures in Python**](https://docs.python.org/3/tutorial/datastructures.html) from the Python 3 documentation. + + + +## Exception messages + +Sometimes it is necessary to raise an exception. When you do this, you should include a meaningful error message to +indicate what the source of the error is. This makes your code more readable and helps significantly with debugging. Not +every exercise will require you to raise an exception, but for those that do, the tests will only pass if you include +a message. + +To raise a message with an exception, just write it as an argument to the exception type. For example, instead of +`raise Exception`, you should write: + +```python +raise Exception("Meaningful message indicating the source of the error") +``` + +## Running the tests -Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/` directory. +To run the tests, run the appropriate command below ([why they are different](https://github.com/pytest-dev/pytest/issues/1629#issue-161422224)): -For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit /python/bob/bob.py`. +- Python 2.7: `py.test high_scores_test.py` +- Python 3.4+: `pytest high_scores_test.py` +Alternatively, you can tell Python to run the pytest module (allowing the same command to be used regardless of Python version): +`python -m pytest high_scores_test.py` + +### Common `pytest` options + +- `-v` : enable verbose output +- `-x` : stop running tests on first failure +- `--ff` : run failures from previous test before running other test cases + +For other options, see `python -m pytest -h` + +## Submitting Exercises + +Note that, when trying to submit an exercise, make sure the solution is in the `$EXERCISM_WORKSPACE/python/high-scores` directory. + +You can find your Exercism workspace by running `exercism debug` and looking for the line that starts with `Workspace`. For more detailed information about running tests, code style and linting, -please see the [help page](http://exercism.io/languages/python). +please see [Running the Tests](http://exercism.io/tracks/python/tests). ## Source Tribute to the eighties' arcade game Frogger ## Submitting Incomplete Solutions + It's possible to submit an incomplete solution so you can see how others have completed the exercise.