Python Flashcards
variable
Stores and names a piece of data.
boolean
Data type that can only be True (1) or False (0).
string
Function that can contain letters, numbers, and symbols.
whitespace
Formatting used to properly structure code.
editor
Area within which code is written.
interpreter
Display that runs your code line by line while checking for any errors.
comment
#
comment block
””
addition
+
subtraction
-
multiplication
*
division
/
exponentiation
**
modulo division resulting in just the remainder
%
escape character
\
string length
len( )
remove string capitalization
.lower()
capitalize string
.upper()
convert selection to string
str( )
Calls following code to display in console.
combine variable with string(s)
“string text with &s and stuff” & (StrName)
control flow
allowance to choose from outcomes based on what else is happening in the program
comparator
checks a variable against another regarding the specified operation resulting in True or False
equal to
==
not equal to
!=
less than
less than or equal to
greater than
>
greater than or equal to
>=
boolean operators
compares statements and results in boolean values
and
boolean operator that checks if both statements are True
or
boolean operator that checks if at least one statement is True
not
boolean operator that gives the opposite of the statement
order of boolean operators
( ) > not > and > or
conditional statements
if, else, elif
if
conditional statement that runs a function after making sure the statement is True
else
conditional statement that runs a function in the event of all “if statements” being False
elif
conditional statement used to run a function when the original “if statement” is False but meets its own stated characteristics
raw_input()
function that accepts a string (in the parentheses which can print as a solicitation prompt for the user) and assigns entered data to the specified prefixed variable as a string or other declared data type (like numerals)
function
a reusable section of code written to perform a specific task in a program
def
groups and sequesters relevant data regarding the function you name following the command
components of a function
header, must include the term “def,” name of the function, and any required parameters; optional comment to explain its use; the body describing the procedures being carried out which MUST be indented similar to conditional statements
sleep
function that forces the program to delay the next line of code from processing for the amount of seconds indicated
\n
escape character to put following string contents on a new line
floating-point numbers
numbers represented in computer hardware as base 2 (binary) fractions *remember that the display usually only shows a few numbers for ease of reading and fractions will never be exactly represented