exercism

Exercism solutions.
git clone git://code.dwrz.net/exercism
Log | Files | Refs

README.md (2556B)


      1 # Hello World
      2 
      3 The classical introductory exercise. Just say "Hello, World!".
      4 
      5 ["Hello, World!"](http://en.wikipedia.org/wiki/%22Hello,_world!%22_program) is
      6 the traditional first program for beginning programming in a new language
      7 or environment.
      8 
      9 The objectives are simple:
     10 
     11 - Write a function that returns the string "Hello, World!".
     12 - Run the test suite and make sure that it succeeds.
     13 - Submit your solution and check it at the website.
     14 
     15 If everything goes well, you will be ready to fetch your first real exercise.
     16 
     17 ## Exception messages
     18 
     19 Sometimes it is necessary to raise an exception. When you do this, you should include a meaningful error message to
     20 indicate what the source of the error is. This makes your code more readable and helps significantly with debugging. Not
     21 every exercise will require you to raise an exception, but for those that do, the tests will only pass if you include
     22 a message.
     23 
     24 To raise a message with an exception, just write it as an argument to the exception type. For example, instead of
     25 `raise Exception`, you should write:
     26 
     27 ```python
     28 raise Exception("Meaningful message indicating the source of the error")
     29 ```
     30 
     31 ## Running the tests
     32 
     33 To run the tests, run the appropriate command below ([why they are different](https://github.com/pytest-dev/pytest/issues/1629#issue-161422224)):
     34 
     35 - Python 2.7: `py.test hello_world_test.py`
     36 - Python 3.4+: `pytest hello_world_test.py`
     37 
     38 Alternatively, you can tell Python to run the pytest module (allowing the same command to be used regardless of Python version):
     39 `python -m pytest hello_world_test.py`
     40 
     41 ### Common `pytest` options
     42 
     43 - `-v` : enable verbose output
     44 - `-x` : stop running tests on first failure
     45 - `--ff` : run failures from previous test before running other test cases
     46 
     47 For other options, see `python -m pytest -h`
     48 
     49 ## Submitting Exercises
     50 
     51 Note that, when trying to submit an exercise, make sure the solution is in the `$EXERCISM_WORKSPACE/python/hello-world` directory.
     52 
     53 You can find your Exercism workspace by running `exercism debug` and looking for the line that starts with `Workspace`.
     54 
     55 For more detailed information about running tests, code style and linting,
     56 please see [Running the Tests](http://exercism.io/tracks/python/tests).
     57 
     58 ## Source
     59 
     60 This is an exercise to introduce users to using Exercism [http://en.wikipedia.org/wiki/%22Hello,_world!%22_program](http://en.wikipedia.org/wiki/%22Hello,_world!%22_program)
     61 
     62 ## Submitting Incomplete Solutions
     63 
     64 It's possible to submit an incomplete solution so you can see how others have completed the exercise.