@@ -5,7 +5,7 @@ Programs in files
55
66In this chapter we will start to learn how to combine pieces of code into
77larger units, and how to package up your code so that you or others can do the
8- same. You will previously have written Python code in Jupyter notebooks, and
8+ same. You may previously have written Python code in Jupyter notebooks, and
99possibly used an interactive Python environment such as IPython. Jupyter
1010notebooks are an excellent platform for writing and documenting short pieces of
1111code. However, they are much less good for writing code which is designed to be
@@ -327,7 +327,7 @@ want: it clearly separates the names in the module from the names we
327327have defined ourselves, and makes it very obvious to a reader where
328328the names come from. The downside is that names in namespaces can be
329329quite long and cumbersome, which is particularly inconvenient if names
330- are to be used frequently or in the middle of formulae : you probably
330+ are to be used frequently or in the middle of expressions : you probably
331331don't really want to write :func: `math.sin ` in every trig formula you
332332ever write. One alternative is to rename the module on import. This is
333333achieved using the keyword :keyword: `as <import> ` in an import statement. For example,
@@ -449,7 +449,7 @@ they make up the Python package.
449449 This is not really a part of the package at all, but the
450450 :file: `my_package ` folder needs to be in some folder, and this is a
451451 reminder that all your work should be in a revision control system
452- such as :ref: `git < fons: git >`. It would be usual for
452+ such as :ref: `Git < git >`. It is usual for
453453 package folders to be contained immediately in the top level of
454454 the repository, in the manner shown here.
455455
@@ -927,7 +927,9 @@ Exercises
927927
928928Before attempting the exercises, ensure that you have obtained the software
929929tools described in :numref: `tools ` and set up a working folder and
930- :term: `virtual environment ` as described in :numref: `venv `.
930+ :term: `virtual environment ` as described in :numref: `venv `. If you're not
931+ already familiar with Git and GitHub then you will also need to work through
932+ :numref: `Appendix %s <git >` to learn enough to do the exercises.
931933
932934.. .. panels::
933935.. :card: quiz shadow
@@ -943,40 +945,68 @@ tools described in :numref:`tools` and set up a working folder and
943945.. you will use for this course on your computer. Start with an overall folder
944946.. for the module, and create a virtual environment in that module.
945947
948+ .. only :: book
949+
950+ .. raw :: latex
951+
952+ \clearpage
953+
946954.. _course_repo :
947955
948956.. proof :exercise ::
949957
950- Visit the `GitHub repository for these notes
951- <https://github.com/object-oriented-python/object-oriented-programming> `__.
952- Clone that git repository into your course folder, and install the Python
953- package it contains into your virtual environment. Check that it has
954- installed correctly by installing Pytest, and running:
958+ .. only :: not book
959+
960+ Visit the `GitHub repository for this book
961+ <https://github.com/object-oriented-python/object-oriented-programming> `__.
962+ Clone that git repository into your course folder, and install the Python
963+ package it contains into your virtual environment. Check that it has
964+ installed correctly by installing Pytest, and running:
965+
966+ .. only :: book
967+
968+ Visit the GitHub repository for this book. [#book_repo ]_
969+ Clone that git repository into your working folder, and install the Python
970+ package it contains into your virtual environment. Check that it has
971+ installed correctly by installing Pytest, and running:
955972
956973 .. code-block :: console
957974
958975 (PoP_venv) $ pytest tests/test_fibonacci.py
959976
960- You could also run iPython , import :mod: `fibonacci ` and try out
977+ You could also run IPython , import :mod: `fibonacci ` and try out
961978 :func: `fibonacci.fib <fibonacci.fibonacci.fib> ` yourself.
962979
963980.. proof :exercise ::
964981
965- Accept the `first GitHub Classroom assignment for this module
966- <https://classroom.github.com/a/VltGa-Xl> `__ and clone it into your course folder. The assignment
967- repository just contains a :file: `README ` and some tests. Your job in the
968- following exercises will be to populate it with the remaining content.
982+ .. only :: not book
983+
984+ Using the information on the `book website
985+ <https://object-oriented-programming.github.io/edition1/exercises.html> `__
986+ create your first exercise repository for this module and clone it
987+ into your working folder. The exercise repository just contains a
988+ :file: `README ` and some tests. Your job in the following exercises will be
989+ to populate it with the remaining content.
990+
991+ .. only :: book
992+
993+ Using the information on the `book website ` [#exercise_page ]_
994+ create your first exercise repository for this module and clone it
995+ into your working folder. The exercise repository just contains a
996+ :file: `README ` and some tests. Your job in the following exercises will be
997+ to populate it with the remaining content.
998+
969999
9701000.. proof :exercise ::
9711001
9721002 Create a new Python :term: `package ` named :mod: `math_utils ` containing a
9731003 :term: `module ` called :mod: `primes `. In the :mod: `primes ` module define a
9741004 function :func: `isprime ` which takes in a single integer argument and
975- returns `True ` or `False ` depending on whether or not the argument is prime.
976- There is no need to be sophisticated in the algorithm used to check for
977- primeness, simply checking whether the number is zero modulo any of the
978- integers less than its square root will be fine. Test your code by running
979- the following in your week 2 exercise repository:
1005+ returns `True ` or `False ` depending on whether or not the argument is
1006+ prime. There is no need use a sophisticated algorithm, simply checking
1007+ whether the number is zero modulo any of the integers less than its square
1008+ root will be fine. Test your code by running the following in the exercise
1009+ repository:
9801010
9811011 .. code-block :: console
9821012
@@ -1029,4 +1059,10 @@ tools described in :numref:`tools` and set up a working folder and
10291059 <https://docs.python.org/3/reference/simple_stmts.html#import> `__
10301060
10311061 .. [#packaging ] `https://packaging.python.org
1032- <https://packaging.python.org/tutorials/packaging-projects/> `__
1062+ <https://packaging.python.org/tutorials/packaging-projects/> `__
1063+
1064+ .. [#book_repo ] `https://github.com/object-oriented-python/object-oriented-programming
1065+ <https://github.com/object-oriented-python/object-oriented-programming> `__
1066+
1067+ .. [#exercise_page ] `https://object-oriented-programming.github.io/edition1/exercises.html
1068+ <https://object-oriented-programming.github.io/edition1/exercises.html> `__
0 commit comments