print and input (always returns a string) statements
Comments
Using Functions like print and input
Variable names are case sensitive
Guess the Number
Import statement
randint function - random.randint(1, 20) # get a number between 1 and 20
for, if, else, break (leaves loop early) statements
code blocks defined by indentation
range(6) - actually numbers 0 to 5
int(), float(), str()
Booleans - True or False
= (assign), == (compare)
! not operator
A Joke Telling Program
Escape characters - \t for tab, \ to actually print a backlash, \' single quote without terminating string
print('String', end='') - to not go to a new line after the print statement
Dragon Realm
Flowcharts
Creating your own functions
Multiline strings - line breaks are retained when printing.
While loops
and, or, not boolean operators
Truth tables
return keyword from functions
Global and local variable scope - A local scope is created whenever a function is called. Any variables assigned in this function exist within the local scope. Variables that are assigned outside of functions exist in the global scope.
Parameters and arguments - called with an argument, used in the local function as a parameter
sleep() function - argument is integer number of seconds