NEW
Font size
WorksheetsPython 2 TEST
Total questions: 30
Worksheet time: 15mins
Provide context for why something is written the way it is:
comments
strings
variables
When printing things in Python, we are supplying a text block that we want to be printed. It is so named because they're a series of letters, numbers, or symbols connected in order — as if threaded together by string.
variables
integers
floats
strings
In Python, and when programming in general, we need to build systems for dealing with data that changes over time. That data could be the location of a plane, or the time of day, or the television show you're currently watching.
strings
variables
booleans
integers
Addition, subtraction, multiplication, division, and other numeric calculations are easy to do in most programming languages.
arithmetic
addition
subtraction
math
This function is used to tell a computer to talk.
talk
speak
variable
Whole number with no decimal point
whole number
decimal
float
integer
A number with a decimal point
boolean
integer
float
decimal
This is like a light switch. It can only have two values. Just like a light switch can only be on or off, this can only be True or False.
boolean
and/or
true/false
print statement
Used to structure code. On Codeacademy, we will use two-space indentation (two blank spaces for each indentation) to make sure you can easily read code with multiple indentations in your browser.
white space
indention
Python 2
blank space
The window on the right side of the page is called the _______________. This runs your code line by line, and checks for any errors.
screen
answer
console
monitor
A line of text that Python won't try to run as code. It's just for humans to read.
parentheses
string
single line comments
multiple line comments
Prints text on more than one line. Include the whole block in a set of triple quotation marks
variable
comments
single line comments
multi-line comments
Use ____ to multiply numbers in Python.
*
/
+
x
Can contain letters, numbers, and symbols.
variable
text
Boolean
string
Gets the length (the number of characters) of a string!
upper()
lower()
str()
len()
method to get rid of all the capitalization in your strings.
upper()
lower()
len()
str()
a string completely in ALL CAPS.
upper()
UPPER()
lower()
LOWER()
print "Life " + "of " + "Brian"
string concatenation
string combination
string concentration
string sentences
Sometimes you need to combine a string with something that isn’t a string. In order to do that, you have to convert the non-string into a string.
string combination
string concatenation
Explicit string conversion
to retrieve the current date and time.
datetime.now()
datetime.month()
datetime.day()
datetime.year()
==
Greater Than
Less Than
Not equal to
Equal to
!=
greater than
less than
not equal to
equal to
**
to the power of (exponentiation)
greater than
equal to
makes a comment
%
The remaining number left over when you divide.
multiplication
not equal to
exponents
**
multiply
exponent - to the power of
divide
add
The order of Boolean operators is:
NOT, AND, OR
TRUE
FALSE
The area we type our code.
Concatenation
Interpret
Console
Editor
The Boolean operator AND returns ___________ when the expressions on both sides of and are true.
True
False
AND
OR
Elif means:
OR
ELSE
else if
NOT
Python 2 allows the user to put "" or '' around strings of text. Ex. "dog" or 'dog'
true
false
