1.3. 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.

1.3.1. 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.

1.3.1.1. Try It!

Answer the following practice questions:

Question

Multiple Choice: Select the correct option!

  1. Pick this answer!!!
  2. Don't choose this answer.
  3. Don't choose this answer either.
  4. I insist on losing this point.

Question

Multiple Answers: Try clicking each of the options below (the words, not the letter labels).

  1. Option a
  2. Option b
  3. Option c
  4. Option d
  5. Option e

1.3.2. 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.

1.3.2.1. Try It!

Here is an example of the repl.it code editor. The coding panel appears at the top of the frame, with the output below.

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.

1.3.3. Longer Examples and End of Chapter Exercises

Longer examples and practice problems have links to Repl.it 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.

Warning

Depending on your school’s privacy policy, student access to either site may be restricted. Check with your teacher before creating an account!

  1. Repl.it signup.
  2. 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.

Image showing the Fork and Remix buttons to save code to your repl.it or Trinket account.

Repl.it uses the Fork button to save a copy of the code. Trinket calls it Remix.

1.3.3.1. 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.

Example

You need to be logged into your account in order to save any changes you make to the code.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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