Keywords Flashcards
del
delete from dictionary
except
Debugging: If an exception happens, do this..ex: except ValueError as e: print(e)
exec
Run a string as python. ex: exec ‘print(“hello”)’
finally
exceptions or not, finally do this no matter what. ex: finally: pass
for
loop over a collection of things. ex: for i in row:
print(i)
from
import specific parts from a module from flask import Flask
global
make this a global variable
global x
if
if condition
if x < 9:
print(“x is less than 9”)
import
import a module
in
part of a for loop.
for word in phrase:
print(word)
is
Like == to test equality
1 is 1 == True
lambda
Create a short anonymous function.
s = lambda y: y ** y; (s)3
not
logical not
if word not in phrase:
print(“That is not in the phrase”)
not True == False
or
logical or
True or False == True
pass
Filler word. Used to create an empty suite or block. def word(): pass