Chapter 1 - Concept Summary¶
Chapter 1 included the following concepts from computing.
- Code - Code is a set of instructions that a computer can understand. This is sometimes called a program.
- Comment - Comments explain what we’re doing in the programs and are
intended to be read by people, not computers. In Python a comment starts
with
#
. The computer will ignore everything from the start of the comment to the end of that line. - Dot-Notation - Dot-notation is how you ask an object to do something in
Python. You use the name of the object followed by a dot (period) and then
followed by what you want it to do and then any values in parentheses. For
example to return a new string will all lowercase letters from a variable
called
sentence
usesentence.lower()
. To ask a turtle namedalex
to go forward 50 units usealex.forward(50)
. - Library - A library is a group of programs that provides some
functionality. The
Turtle
library is a good example. It lets us create and work withTurtle
objects. The Python Imaging Library (PIL
) lets us work with images. - Pixel - A pixel is one small part (element) of a picture. Pixels are stored in a grid and have both x (horizontal) and y (vertical) values. A pixel has a color which can be defined by an amount of red, green, and blue with values from 0 to 255.
- Program - A program is a set of instructions that a computer can understand to accomplish some goal. This is sometimes called code.
- Screen - A
Screen
is part of the Turtle library. It is a space on the page for the turtle to move in and draw on. - String - A string is anything we can type between a pair of pair of
single quotes (
'Hi'
), double quotes ("Hi"
), or triple quotes ('''Hi'''
). It is a sequence of characters. - Variable - A variable is a name associated with computer memory that can hold a value and that value can change or vary. One example of a variable is the score in a game.