Using This Book
===============
Throughout this book, you will find different types of exercises. Each one
gives you a quick way to review or practice coding. To get the most out of the
book, try ALL of the tasks.
Concept Checks
--------------
Many pages end with a *Check Your Understanding* section, which contains a few
quick questions. You should use these as a review of what you just read.
The concept check questions are partially interactive---you can often click on
your chosen answer(s) to see if you are correct. However, your choices are NOT
saved. Leaving or refreshing the page erases the results.
If you want to save your answers, we recommend keeping a notebook where you can
write down the questions/answers that you find the most important or
interesting.
Try It!
^^^^^^^
.. raw:: html
Answer the following practice questions:
.. admonition:: Question
Multiple Choice: Select the correct option!
.. raw:: html
Pick this answer!!!
Don't choose this answer.
Don't choose this answer either.
I insist on losing this point.
.. admonition:: Question
Multiple Answers: Try clicking each of the options below (the words, not
the letter labels).
.. raw:: html
Option a
Option b
Option c
Option d
Option e
In-Page Examples
----------------
Some sections provide coding practice. These short examples include code
you can run and/or modify to quickly reinforce what you just read. Play around
with these!
We use two sites to provide the embedded code editors: Repl.it and Trinket.
The appearance of the editors differs, but they both function in a similar
manner. You type your code into one panel, click the *Run* button, and the
program results get displayed in a second panel.
Try It!
^^^^^^^
.. admonition:: Tip
If you find the coding space in the embedded editors a little too small, you
can expand them. For repl.it editors, clicking on the *open in repl.it*
button in the upper-right corner opens the editor into its own browser tab.
For Trinket editors, click on the three horizontal bars in the upper-left
corner. Choose the *Fullscreen* option to expand the workspace.
Here is an example of the repl.it code editor. The coding panel appears at the
top of the frame, with the output below.
.. raw:: html
Here is an example of the Trinket code editor. The coding panel appears at the
left of the frame, with the output to the right. Also, clicking on the
*Instructions* tab displays steps for you to follow.
.. raw:: html
.. index:: ! Replit, ! trinket.io
Longer Examples and End of Chapter Exercises
--------------------------------------------
Longer examples and practice problems have links to **Replit** or
**Trinket.io**. These websites allow you to write, run, and save your code.
Repl.it and Trinket accounts are free, so we encourage you to sign up for one.
.. admonition:: Warning
Depending on your school's privacy policy, student access to either site may
be restricted. Check with your teacher before creating an account!
#. `Replit signup `__.
#. `Trinket.io signup `__.
As you explore the examples in this book, feel free to make changes to
the code. If you want to save your edits, click the *Fork* or *Remix* button at
the top of the workspace. Repl.it/Trinket will store a copy of the code in your
personal account.
.. figure:: figures/fork-remix-buttons.png
:alt: Image showing the Fork and Remix buttons to save code to your repl.it or Trinket account.
:width: 70%
Repl.it uses the Fork button to save a copy of the code. Trinket calls it Remix.
Try It!
^^^^^^^
Here is the same code used in the example above. Click on each link to open it
in the repl.it or Trinket workspaces.
.. admonition:: Example
You need to be logged into your account in order to save any changes you
make to the code.
.. sourcecode:: python
:linenos:
import turtle
bob = turtle.Turtle()
bob.color('blue')
bob.shape('turtle')
bob.left(90)
bob.circle(75)
# Try changing the color or shape (circle, square, triangle, arrow) for bob.
# Try changing the size of the circle.
`Repl.it link `__
`Trinket.io link `__