10 September 2020

Housekeeping Here are a few items.

Two Mini-Challenges Print these to the screen.

*
**
***
****
*****

       *
      * *
     * * * 
    * * * *
   * * * * *
  * * * * * *
      * *
      * *

Boss Statements: Functions

We wrote a couple of programs and they are BORING! What are we gonna do? We will begin to learn a little about boss statements; these are a remedy.

What is a boss statement? A boss statement is a statement that alters the flow of code. Boss statements have these characteristics.

Functions

We will learn how to define functions today. They are a way to divide code into logical bits you can use over and over again. You will get some practice writing functions today.

def This is a boss statement that means, "To define," The header of a function looks like this

def function_name(arg(s)):
    block

What Stays in Vegas Python has function scope; varibles created inside of functions are invisible outside of them. You will quickly see that this is an advantage.

Importing A Module