Skip to main content

cs_disc_1

Vocab: Expressions and Values Statements:

  • Every expression will evaluate to a value.

  • Statements do not evluate to values but modify the flow of the program

  • Assignment statements
  • if statneemtns(conditional statements)
  • def statements
  • while loops
  • Can't exactly print or return a statement

  • Later on, we'll run into some expressions that look similar to statemnets

Control Minilecture if condition: body of code Check condition -> if expression evaluates to True, execute code inside!

check condition ONLY IF previous if statement's condition was False! elif -> else if cond

We reach the else if all the previous conditions evaluated to False

Environment Diagrams:

  • Environment diagrams are the system we use to keep track of variables/functions and their values.
  • We start off in the global frame when we first start a program
    • new frames are opened when we calla new function
  • PythonTutor is very helpful for walking through environemnt diagram q's (Resources Tab of cs61a.org website)