In [ ]:
# Initialize Otter
import otter
grader = otter.Notebook("06_lecture_functions.ipynb")

Functions in Python

Theme: Hurricanes Basketball Ticketing System -- Watsco Center

Goal: Learn to write functions from first principles -- defining functions, understanding scope, passing arguments, returning values, using default parameters, and importing standard library modules. We'll build a ticket ordering system for Miami Hurricanes basketball games at Watsco Center.

By the end of this notebook, you will be able to:

  • Define and call functions using def
  • Pass arguments to functions, including tuples
  • Understand variable scope (local vs global)
  • Write functions that return values
  • Use default and keyword arguments
  • Import and use standard library modules (random, math)
  • Compose functions by calling one function inside another

Connection to the for loops lab: In the lab, you used tuples with index constants for player data (player[PPG]). We're using the same pattern here for ticketing data -- same idea, different context.

Important: Run cells in order from top to bottom. Later questions use variables from earlier cells.

In [ ]:
# Validation: Check Python version and file location
import os
import sys

# Supported Python versions for this course
SUPPORTED_VERSIONS = ["3.12", "3.13"]
current_version = f"{sys.version_info.major}.{sys.version_info.minor}"

if current_version not in SUPPORTED_VERSIONS:
    raise EnvironmentError(
        f"Python version mismatch!\n"
        f"Supported: {', '.join(SUPPORTED_VERSIONS)}\n"
        f"Found: {current_version}\n"
        f"Please use Python 3.12 or 3.13 for this course."
    )
print(f"Python version: {current_version}")

# Expected filename for this assignment
EXPECTED_FILE = "06_lecture_functions.ipynb"

# Check file is in the correct directory
current_path = os.path.abspath("")
required_path_segment = os.path.join("Documents", "CSC115", "lecture_notebooks")
allowed_envs = ["submission", "dist", "live", "source"]
in_allowed_env = any(env in current_path for env in allowed_envs)

if required_path_segment not in current_path and not in_allowed_env:
    raise EnvironmentError(
        f"File location error!\n"
        f"This notebook should be in: ~/Documents/CSC115/lecture_notebooks/\n"
        f"Current location: {current_path}\n"
        f"Please move this file to the correct directory."
    )

# Verify filename (skip in grading/development environments)
if not in_allowed_env:
    if not os.path.exists(EXPECTED_FILE):
        notebooks = [f for f in os.listdir(".") if f.endswith(".ipynb")]
        raise EnvironmentError(
            f"Filename mismatch!\n"
            f"Expected: {EXPECTED_FILE}\n"
            f"Found notebooks: {notebooks}\n"
            f"Please rename your notebook to '{EXPECTED_FILE}'."
        )

print(f"File location: {os.path.join(current_path, EXPECTED_FILE)}")

Hurricanes Basketball Ticketing Data

Before we start learning about functions, let's set up our data. Here's ticket pricing information for Watsco Center, home of Miami Hurricanes basketball.

The data is stored as tuples with named index constants -- the same pattern you used in the for loops lab for player data. Instead of player[PPG], we'll use section[SECTION_PRICE] and game[OPPONENT]. Same idea, different data.

In [ ]:
# --- Hurricanes Basketball Ticketing Data ---
# Watsco Center - Home of Miami Hurricanes Basketball

# Index constants for seating sections
# Each section is a tuple: (name, base_price)
SECTION_NAME = 0
SECTION_PRICE = 1

sections = [
    ("Courtside", 150.00),
    ("Lower Bowl", 75.00),
    ("Upper Bowl", 40.00),
    ("Student Section", 15.00),
]

# Index constants for games
# Each game is a tuple: (opponent, date, type)
OPPONENT = 0
GAME_DATE = 1
GAME_TYPE = 2

games = [
    ("Florida State", "Feb 28", "rivalry"),
    ("Duke", "Mar 1", "rivalry"),
    ("Georgia Tech", "Mar 5", "regular"),
    ("NC State", "Mar 8", "regular"),
    ("Virginia", "Mar 12", "regular"),
]

# Pricing rules (constants)
RIVALRY_MULTIPLIER = 1.5  # Rivalry games cost 1.5x the base price
STUDENT_DISCOUNT = 0.20  # Students get 20% off
TAX_RATE = 0.07  # 7% Florida sales tax

print(f"Loaded {len(sections)} seating sections and {len(games)} upcoming games!")
print(f"Example: sections[0] = {sections[0]}")
print(f"  sections[0][SECTION_NAME]  = '{sections[0][SECTION_NAME]}'")
print(f"  sections[0][SECTION_PRICE] = ${sections[0][SECTION_PRICE]:.2f}")
print(f"Example: games[0] = {games[0]}")
print(f"  games[0][OPPONENT]  = '{games[0][OPPONENT]}'")
print(f"  games[0][GAME_DATE] = '{games[0][GAME_DATE]}'")
print(f"  games[0][GAME_TYPE] = '{games[0][GAME_TYPE]}'")

Why tuples with index constants? In the for loops lab, you used player[PPG] instead of remembering index 8. We're using the same pattern here: section[SECTION_PRICE] instead of remembering which index holds the price. Same idea, different data.


1. The Big Picture

Before we dive into individual concepts, let's see what you'll be able to build by the end of this notebook. Here's a complete function that generates a ticket receipt using all the concepts we'll learn:

  • def (defining a function)
  • Parameters and arguments
  • return values
  • Default parameters
  • import random
  • Conditionals inside functions
  • Variable scope

Don't worry if you don't understand every line yet! By the end of this notebook, you'll be able to write each piece yourself.

In [ ]:
# THE BIG PICTURE: Complete ticket receipt generator
# By the end of this notebook, you'll understand every line!

import random


def generate_receipt(section_idx, game_idx, num_tickets, student=False):
    """Generate a complete ticket receipt for a Hurricanes basketball game.

    Demonstrates: def, parameters, return, scope, default args, import, conditionals
    """
    # Look up data from our lists
    seat_area = sections[section_idx]
    matchup = games[game_idx]

    print("=" * 50)
    print("  MIAMI HURRICANES BASKETBALL")
    print("  Watsco Center - Ticket Confirmation")
    print("=" * 50)

    # Calculate price - all in one chain
    unit_cost = seat_area[SECTION_PRICE]
    if matchup[GAME_TYPE] == "rivalry":
        unit_cost = unit_cost * 1.5
    if student:
        unit_cost = unit_cost * 0.80

    # Compute final amount
    before_tax = unit_cost * num_tickets
    sales_tax = before_tax * 0.07
    amount_due = round(before_tax + sales_tax, 2)

    # Assign a confirmation number
    conf = f"CANES-{random.randint(10000, 99999)}"

    # Print receipt
    print(f"\n  Game: Miami vs {matchup[OPPONENT]}")
    print(f"  Date: {matchup[GAME_DATE]}")
    print(f"  Section: {seat_area[SECTION_NAME]}")
    print(f"  Tickets: {num_tickets}")
    print(f"  Price/ticket: ${unit_cost:.2f}")
    if student:
        print("  (Student discount applied)")
    print(f"  Subtotal: ${before_tax:.2f}")
    print(f"  Tax: ${sales_tax:.2f}")
    print(f"  TOTAL: ${amount_due:.2f}")
    print(f"\n  Confirmation: {conf}")
    print("=" * 50)

    return amount_due


# Run it! Pass in INDEX positions, not tuples
generate_receipt(1, 1, 2, student=True)

This one function does EVERYTHING -- pricing, discounts, tax, confirmation codes, printing. But what if we want to calculate a price without printing a receipt? Or generate a confirmation code for something other than tickets? Or reuse the student discount for merchandise?

We need to break this into smaller, reusable pieces. That's what functions are for, and that's what this notebook teaches.


Day 1: Function Foundations


2. Why Functions?

You've been writing code that runs top-to-bottom. But what happens when you need the same code in multiple places?

In [ ]:
# WITHOUT functions: print ticket info for 3 games (lots of repeated code)
print("=" * 40)
print(f"  Miami vs {games[0][OPPONENT]}")
print(f"  Section: {sections[1][SECTION_NAME]}")
print(f"  Price: ${sections[1][SECTION_PRICE]:.2f}")
print("=" * 40)

print("=" * 40)
print(f"  Miami vs {games[1][OPPONENT]}")
print(f"  Section: {sections[1][SECTION_NAME]}")
print(f"  Price: ${sections[1][SECTION_PRICE]:.2f}")
print("=" * 40)

print("=" * 40)
print(f"  Miami vs {games[2][OPPONENT]}")
print(f"  Section: {sections[1][SECTION_NAME]}")
print(f"  Price: ${sections[1][SECTION_PRICE]:.2f}")
print("=" * 40)

# What if we want to change the format? Change it 3 times!
# What if there are 20 games? 20 copies of the same code!

Key vocabulary:

  • Define: Write the function (create the recipe)
  • Call: Run the function (follow the recipe)
  • DRY: Don't Repeat Yourself -- write code once, use it many times

Functions solve the DRY problem. Write the code once inside a function, then call it whenever you need it.


3. Defining and Calling Functions

In [ ]:
# A function packages up reusable code
# "void" = does something (like printing) but doesn't give back a value


def print_welcome():
    """Print a welcome message for Watsco Center."""
    print("=" * 40)
    print("  Welcome to Watsco Center!")
    print("  Home of Miami Hurricanes Basketball")
    print("=" * 40)


# IMPORTANT: Defining a function does NOT run it!
# Nothing happens until we CALL it:
print_welcome()
In [ ]:
# Defining: Writing the recipe (nothing happens)
def print_separator():
    """Print a visual separator line."""
    print("-" * 40)


# Calling: Following the recipe (code runs!)
print_separator()
print("Between separators")
print_separator()

# You can call as many times as you want!
In [ ]:
# When planning code, use pass as a placeholder
# Without pass, an empty function would cause a syntax error
def print_receipt():
    """Print a ticket receipt (coming soon!)."""
    pass


print_receipt()  # Runs without error, does nothing

The colon : at the end of the def line and the indentation below it are CRITICAL. Everything indented under def is part of the function. When the indentation ends, the function ends.


4. Parameters and Arguments

Parameters let you customize what a function does. Think of them as blank spaces on a form -- you fill them in when you call the function.

In [ ]:
# Parameters let you customize what a function does
# Think of parameters as blank spaces in a form - you fill them in when you call


def print_game_info(opponent, date):
    """Print information about an upcoming game."""
    print(f"Miami Hurricanes vs {opponent}")
    print(f"Date: {date}")
    print("Venue: Watsco Center")
    print()


# Call with different ARGUMENTS (the actual values)
print_game_info("Florida State", "Feb 28")
print_game_info("Duke", "Mar 1")

Key terminology:

  • Parameter: The variable name in the def line (like a blank on a form)
  • Argument: The actual value you pass when calling (what you write on the form)
  • opponent is the parameter; "Duke" is the argument
In [ ]:
# You can pass TUPLES as arguments too!
# In the lab, you passed roster data to functions. Same idea here.


def print_game_from_tuple(game):
    """Print game info from a game tuple."""
    print(f"Miami vs {game[OPPONENT]} on {game[GAME_DATE]} ({game[GAME_TYPE]})")


# Pass each game tuple from our list
for game in games:
    print_game_from_tuple(game)

In the for loops lab, you passed the roster to functions like find_top_scorer(roster). Same pattern here -- we pass a game tuple to the function, and it uses index constants to access the fields. This is why we set up OPPONENT = 0, GAME_DATE = 1, etc.


5. Variable Scope

Variables created inside functions are LOCAL -- they exist only inside the function. Variables created outside are GLOBAL -- they can be read (but not modified) inside functions.

In [ ]:
# Variables created INSIDE a function are LOCAL
# They only exist while the function runs


def sell_ticket():
    ticket_id = "A-001"
    print(f"Inside function: ticket_id = {ticket_id}")


sell_ticket()

# Uncomment the next line to see the error:
# print(ticket_id)  # NameError! ticket_id doesn't exist out here
In [ ]:
# Variables created OUTSIDE functions are GLOBAL
# Functions CAN read them

venue_name = "Watsco Center"


def show_venue():
    print(f"The venue is: {venue_name}")  # Reading global - OK!


show_venue()
print(f"Outside: {venue_name}")  # Still accessible here too
In [ ]:
# CAREFUL: Assigning inside a function creates a NEW local variable
# It does NOT change the global!

demo_price = 75.00


def apply_markup():
    demo_price = 100.00  # Creates a NEW local variable!
    print(f"Inside: demo_price = {demo_price}")


apply_markup()
print(f"Outside: demo_price = {demo_price}")  # Still 75.00!

Key rule: What happens in a function STAYS in the function -- unless you explicitly return it (Day 2). Think of a function like a kitchen: you can look out the window and read the menu board (globals), but the food you're preparing (locals) stays in the kitchen until you serve it (return).

About our constants: Notice our pricing constants (RIVALRY_MULTIPLIER, STUDENT_DISCOUNT, TAX_RATE) are global. Functions can read these freely. Using ALL_CAPS is a convention that signals "this value shouldn't change." Our index constants (SECTION_NAME, OPPONENT, etc.) are global too -- that's how every function can use them.


Question 1: Format a Game Listing (1 point)

Write a function called format_game_listing that takes a game tuple as a parameter and returns a formatted string describing the game. The string should have three lines: who is playing (Miami vs the opponent), when (the game date), and where (Watsco Center). Use the index constants you learned about to pull data from the tuple.

Expected output for format_game_listing(games[1]):

Miami vs Duke
Date: Mar 1
Venue: Watsco Center

Hint: Access tuple fields with index constants -- same pattern as player[PPG] from the lab. Use \n inside an f-string to create line breaks.

In [ ]:
def format_game_listing(game):
    """Format a game listing with opponent, date, and venue."""
    ...


# Test it
print(format_game_listing(games[1]))
In [ ]:
grader.check("q1_format_listing")

Question 2: Count Rivalry Games (1 point)

Write a function called count_rivalry_games that takes a list of game tuples as a parameter and returns how many of those games are rivalry matchups. Loop through the list and check each game's type to determine if it qualifies.

Hint: Same counter pattern from the Spotify lecture and the for loops lab -- start at 0, add 1 each time you find a match. But now it's inside a function that takes the list as a parameter and returns the count.

In [ ]:
def count_rivalry_games(game_list):
    """Count the number of rivalry games in a list of game tuples."""
    count = ...
    ...
        ...
    ...


# Test it with our data
print(f"Rivalry games: {count_rivalry_games(games)}")
In [ ]:
grader.check("q2_count_rivalry")

Day 2: Return Values and Power

Quick recap from Day 1:

  • Functions package reusable code: define once, call many times
  • def function_name(parameters): creates a function
  • Parameters can be simple values OR tuples -- just like in the for loops lab
  • Variables inside functions are LOCAL -- they don't exist outside
  • Global variables (like our pricing constants and index constants) CAN be read inside functions

Now let's learn about return values, default parameters, and importing libraries.


6. Value-Returning Functions

So far, our functions have mostly printed things. But what if you want a function to compute a value and give it back to you? That's what return does.

In [ ]:
# VOID function: does something, returns nothing (actually returns None)
def print_price(section):
    """Print a formatted price for a section."""
    print(f"{section[SECTION_NAME]}: ${section[SECTION_PRICE]:.2f}")


void_result = print_price(sections[1])
print(f"Return value: {void_result}")  # None!
print(f"Type: {type(void_result)}")  # <class 'NoneType'>
In [ ]:
# VALUE-RETURNING function: computes and gives back a result
def double_price(section):
    """Double a section's price and return the result."""
    return section[SECTION_PRICE] * 2


returned_result = double_price(sections[1])
print(f"Return value: {returned_result}")  # 150.0
print(f"Type: {type(returned_result)}")  # <class 'float'>
In [ ]:
# IMPORTANT: return immediately exits the function
# Any code AFTER return never runs


def find_section_by_name(section_name):
    """Look up a section tuple by its name."""
    for section in sections:
        if section[SECTION_NAME] == section_name:
            return section  # Found it! Exit immediately
    return None  # Only runs if section wasn't found


print(find_section_by_name("Lower Bowl"))  # ("Lower Bowl", 75.0)
print(find_section_by_name("Courtside"))  # ("Courtside", 150.0)
print(find_section_by_name("VIP Lounge"))  # None (not found)
In [ ]:
# Return values can be used anywhere a regular value can
lower_bowl = find_section_by_name("Lower Bowl")
print(f"Lower Bowl price: ${lower_bowl[SECTION_PRICE]:.2f}")

# You can even chain function calls
print(f"Double price: ${double_price(find_section_by_name('Upper Bowl')):.2f}")

Think of return like serving food from the kitchen. The function computes a result (cooks the food), then return passes it back to whoever called the function (serves it to the customer). Without return, the result stays trapped inside the function.


7. Default and Keyword Arguments

Sometimes you want a parameter to have a default value that gets used if no argument is provided. This makes some arguments optional.

In [ ]:
# Default parameters have a value that's used if no argument is provided
# They make some arguments OPTIONAL


def calculate_discount(price, discount_pct=0.20):
    """Apply a discount to a price. Default is 20% off."""
    discount_amount = price * discount_pct
    return round(price - discount_amount, 2)


# Using the default (20% off)
print(calculate_discount(100.00))  # 80.0

# Overriding the default (10% off)
print(calculate_discount(100.00, 0.10))  # 90.0

Key rule: Default parameters must come AFTER non-default parameters in the definition. def func(required, optional=default): is correct. def func(optional=default, required): is a syntax error.

In [ ]:
# Keyword arguments let you specify WHICH parameter you're filling in
# Useful when a function has several parameters


def format_ticket(section, game, quantity=1, is_student=False):
    """Format a ticket description."""
    label = f"{quantity}x {section[SECTION_NAME]} - Miami vs {game[OPPONENT]}"
    if is_student:
        label += " (Student)"
    return label


# Positional: arguments matched by position
print(format_ticket(sections[1], games[1], 2, True))

# Keyword: arguments matched by name (order doesn't matter for keyword args!)
print(format_ticket(game=games[1], section=sections[1], is_student=True, quantity=2))

# Mix: positional first, then keyword
print(format_ticket(sections[1], games[1], is_student=True))

Keyword arguments are especially useful when a function has default parameters. You can skip the defaults you want to keep and only specify the ones you want to change: format_ticket(sections[1], games[1], is_student=True) -- we skipped quantity (keeps default of 1) but specified is_student.


8. Importing Libraries

Python has thousands of libraries -- code that other people wrote. To use them, you import them. Let's try random and math.

In [ ]:
# Python has thousands of libraries - code that other people wrote
# To use them, you IMPORT them

import random

# random.randint(a, b) returns a random integer between a and b (inclusive)
print(random.randint(1, 100))
print(random.randint(1, 100))
print(random.randint(1, 100))
# Different number each time!
In [ ]:
# random.choice() picks a random item from a list
import random

random_section = random.choice(sections)
print(f"Random seat upgrade: {random_section[SECTION_NAME]}!")
In [ ]:
import math

# math.floor() rounds DOWN to nearest integer
print(math.floor(7.9))  # 7

# math.ceil() rounds UP to nearest integer
print(math.ceil(7.1))  # 8

# math.sqrt() for square root
print(math.sqrt(144))  # 12.0

# Useful for pricing: round tax DOWN to avoid overcharging
price = sections[1][SECTION_PRICE]
tax = price * TAX_RATE
print(f"Tax (raw): {tax}")
print(f"Tax (floor to cents): {math.floor(tax * 100) / 100}")
In [ ]:
import random


# Once imported, you can use the library inside any function
def pick_random_game():
    """Select a random upcoming game."""
    game = random.choice(games)
    return f"Miami vs {game[OPPONENT]} on {game[GAME_DATE]}"


print(pick_random_game())
print(pick_random_game())

Put import statements at the TOP of your notebook (or at least before the function that uses them). You only need to import once -- after that, the library is available everywhere. We already saw from tqdm import tqdm in the for loops lecture. Same idea.


Question 3: Calculate Ticket Price (1 point)

Write a function called calculate_ticket_price that takes a section tuple and a game tuple, and returns the adjusted per-ticket price. The base price comes from the section data. Rivalry matchups cost more than regular games -- use the appropriate pricing constant. Round to 2 decimal places.

Hint: Pull the base price from the section tuple using the appropriate index constant. Check the game type to decide if the rivalry surcharge applies. Look at the constants defined in the data cell.

In [ ]:
def calculate_ticket_price(section, game):
    """Calculate the ticket price based on section and game type."""
    price = ...
    ...
    ...


# Test it
print(f"Lower Bowl regular: ${calculate_ticket_price(sections[1], games[2]):.2f}")
print(f"Lower Bowl rivalry: ${calculate_ticket_price(sections[1], games[1]):.2f}")
In [ ]:
grader.check("q3_ticket_price")

Question 4: Calculate Order Total (1 point)

Write a function called calculate_order_total that takes a per-ticket price, a quantity, and an optional is_student flag (default False). Students get a discount on the per-ticket price. After any discount, calculate the cost for all tickets, apply Florida sales tax, and return the final amount. Round to 2 decimal places.

Hint: Apply the discount BEFORE multiplying by quantity. Tax goes on the subtotal AFTER the discount. Use the constants defined in the data cell for the discount rate and tax rate.

In [ ]:
def calculate_order_total(price_per_ticket, quantity, is_student=False):
    """Calculate the total order cost including tax and optional student discount."""
    ...
    subtotal = ...
    tax = ...
    ...


# Test it
print(f"1 ticket at $75 (no discount): ${calculate_order_total(75.00, 1)}")
print(f"2 tickets at $112.50 (student): ${calculate_order_total(112.50, 2, is_student=True)}")
In [ ]:
grader.check("q4_order_total")

Question 5: Generate Confirmation Code (1 point)

Write a function called generate_confirmation_code that takes no parameters and returns a random confirmation code as a string. The code should look like CANES- followed by a random 5-digit number (no leading zeros). Use the random module.

Hint: Think about which random function generates a whole number in a range. Combine the prefix and the random number into a single string with an f-string.

In [ ]:
def generate_confirmation_code():
    """Generate a random ticket confirmation code."""
    ...


# Test it - should be different each time!
print(generate_confirmation_code())
print(generate_confirmation_code())
print(generate_confirmation_code())
In [ ]:
grader.check("q5_confirmation")

Stretch Goal: Process Complete Order (1 point)

Combine your skills! Write a function called process_complete_order that takes a section tuple, a game tuple, a quantity, and an optional is_student flag (default False). Instead of recalculating everything from scratch, your function should reuse the functions you already wrote to determine the ticket price and the order total. Return the final amount. This is function composition -- building complex behavior from simple building blocks.

Hint: Your earlier functions already know how to compute the price and the total. Call them with the right arguments and chain the results together. Think about what each function needs as input and what it gives back.

In [ ]:
# ✏️ YOUR CODE HERE
...
    ...
    ticket_price = ...
    total = ...
    ...


# Test: 2 Lower Bowl tickets to Duke (rivalry), student discount
order_total = process_complete_order(sections[1], games[1], 2, is_student=True)
print(f"Order total: ${order_total:.2f}")
In [ ]:
grader.check("q6_stretch_order")

Summary

Concept Syntax Ticketing Example
Define a function def name(): def print_welcome():
Parameters def name(param): def format_game_listing(game):
Tuple parameters tuple[INDEX] Access fields with index constants
Return values return value return ticket_price
Call a function name(args) calculate_ticket_price(section, game)
Local variables Created inside function subtotal inside calculate_order_total
Global constants Created outside, read inside RIVALRY_MULTIPLIER, SECTION_PRICE
Default parameters def func(x, y=val): def calc(price, qty, is_student=False):
Keyword arguments func(param=val) calc(75, 2, is_student=True)
Import a library import module import random
Function composition Call functions inside functions process_complete_order() calls calculate_ticket_price()

Key Takeaways

  1. Functions package reusable code -- write once, call many times (DRY)
  2. Parameters let you customize what a function does -- including passing tuples
  3. Return values let functions give back results to use elsewhere
  4. Scope: local variables stay inside functions; globals can be read but not modified
  5. Default parameters make arguments optional
  6. import lets you use code others have written (random, math)
  7. Function composition: functions can call other functions to build complex behavior from simple pieces

What's Next?

  • Lab: Dice game simulator -- practice writing functions with random
  • Next Week: File I/O and exception handling

Submitting to Gradescope

This file is saved on your computer -- you do not need to download it from Jupyter.

  1. Find the file on your computer:

    • Mac: Open Finder → Documents/CSC115/lecture_notebooks/06_lecture_functions/06_lecture_functions.ipynb
    • Windows: Open File Explorer → Documents\CSC115\lecture_notebooks\06_lecture_functions\06_lecture_functions.ipynb
  2. Upload to Gradescope:

    • Go to gradescope.com and open this assignment
    • Click "Submit" and upload the .ipynb file
    • The filename must be exactly 06_lecture_functions.ipynb

Do NOT use File > Download in Jupyter -- this can rename the file and cause submission errors.


You have completed the Functions in Python notebook.


To double-check your work, the cell below will rerun all of the autograder tests.

In [ ]:
grader.check_all()