Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

CodeSignal

Returning Values and Understanding Scope in Python

via CodeSignal

Overview

Return values from Python functions, understand local scope, chain functions into pipelines, and document each function's contract with docstrings.

Syllabus

  • Unit 1: Returning Values in Python
    • Reading a Returned Value
    • From Printing to Returning
    • Using Returned Values Inline
    • Reusing Values and Meeting None
    • Repairing a Missing Return
  • Unit 2: Understanding Function Scope
    • Where rate Lives
    • Returning a Local Instead of Reaching
    • Same Name Different Scope
    • Building compute_tax with a local rate
    • Using a Local Intermediate
  • Unit 3: Chaining Functions Together
    • Following a Value Through Three Functions
    • Chaining Calls in One Expression
    • Inserting a Stage Into the Pipeline
    • Combining Returns and Naming Stages
    • Building the Final Receipt Pipeline
  • Unit 4: Writing Function Contracts
    • Reading a Function's Contract
    • Documenting an Undocumented Function
    • Reading Documentation Back at Runtime
    • Repairing a Stale Contract
    • Writing a Documented Function

Reviews

Start your review of Returning Values and Understanding Scope in Python

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.