Python Basics Flashcards
Start a new line (force return)
/n
Function to ask for user input
var = raw_input( )
Order of Operations
( ), Exponent, * / %, + - (Then evaluate left to right)
Reserved Words 1
assert, def, elif, from, lambda, return, try, break, global, import
Reserved Words 2
del, is, for, while, except, if, not
Reserved Words 3
continue, in, print, yield, or, else, raise, exec, class, and, finally, pass
statement
unit of code that can be executed
What is the function that tells what TYPE a variable is?
type(X) Will be a str, int or float
When expecting a number from prompt input what is the function used to make sure it is a whole number?
int(x)
How do you start a comment line?
This is a comment line with a hashtag.
Define Boolean expressions
Comparison results that evaluate to True or False.
Used to control program flow.
What is the boolean operator that checks if both statements are True?
and (only true if BOTH evaluate to true)
What are the Comparison Operators
< , , >=, ==, !=
Boolean operator to check that at least one statement is true
or (evaluates to true if at least ONE is true)
What does the boolean operator NOT do?
Negates an expression. Return False for true statements and True for false statements.