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.
188.8.131.52. Try It!¶
Answer the following practice questions:
Multiple Choice: Select the correct option!
- Pick this answer!!!
- Don't choose this answer.
- Don't choose this answer either.
- I insist on losing this point.
Multiple Answers: Try clicking each of the options below (the words, not the letter labels).
- Option a
- Option b
- Option c
- Option d
- 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.
184.108.40.206. Try It!¶
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.
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 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.
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.
220.127.116.11. 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.
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.