Python Keywords

The flashcards below were created by user Anonymous on FreezingBlue Flashcards.

  1. and
    Logical and.

    True and False = False
  2. as
    Part of the with-as statement.

    with X as Y: pass
  3. assert
    assert False, "Error!"
  4. break
    Stop this loop right now.

    while True: break
  5. continue
    Don't Process more of the loop, do it again.

    while True: continue
  6. def
    Define a function.

    def x():pass
  7. del
    Delete from dictionary.

    del X[Y]
  8. elif
    Else if condition.

    if: X; elif: Y; else: J
  9. else
    Else condition.

    if: X; elif: Y; else: J
  10. except
    If an exception happens, do this.

    except VauleError, e: print e
  11. exec
    Run a string Python.

    exec 'print "hello"
  12. finally
    Exceptions or not, finally do this no matter what.

    finally: pass
  13. for
    Loop over a collection of things.

    for X in Y: pass
  14. from
    Importing specific parts of a module.

    import X from Y
  15. global
    Declare that you want a global variable.

    global X
  16. if
    If condition.

    if: X; elif: Y; else: J
  17. import
    Import a module into this one to use.

    import os
  18. in
    Part of for-loops. Also a test of X in Y.

    for X in Y: pass also 1 in [1] == True
  19. is
    Like == to test equality.

    1 is 1 == True
  20. lambda
    Create a short anonymous function.

    s = lambda y: y ** y; s(3)
  21. not
    Logical not.

    not True == False
  22. or
    Logical or.

    True or False == True
  23. pass
    This block is empty.

    def empty(): pass
  24. print
    Print this string.

    print 'this string'
  25. raise
    Raise an exception when things go wrong.

    raise ValueError("No")
  26. return
    Exit the function with a return value.

    def X(): return Y
  27. try
    Try this block, and if exception, go to except.

    try: pass
  28. while
    While loop.

    while X: pass
  29. with
    With an expression as a variable do.

    with X as Y: pass
  30. yeild
    Pause here and return to caller.

    def X(): yeild Y; X().next()
Card Set:
Python Keywords
2014-08-14 04:45:20
Python Keywords

Keywords in the programming language python.
Show Answers: