python - functions - Part I

KSATs: A0061, K0007, K0009, K0010, K0011, K0012, K0026, K0027, K0028, K0736, S0014, S0047, S0048, S0050, S0052

Measurement: Written, Performance

Lecture Time: 1 Hour 40 Minutes

Demo/Performance Time: 2 Hours

Instructional Methods: Informal Lecture & Demonstration/Performance

Multiple Instructor Requirements: 1:8 for Labs

Classification: UNCLASSIFIED

Lesson Objectives:

  • LO 1 Understand the scope of a declared variable in Python. (Proficiency Level: B)

  • LO 2 Describe the purpose and use of iterators in Python (Proficiency Level: B)

  • LO 3 Describe the purpose and use of generators in Python (Proficiency Level: B)

  • LO 4 Understand how functions are created and implemented in Python. (Proficiency Level: B)

    • MSB 4.1 Understand the purpose of the return statement in Python. (Proficiency Level: B)
    • MSB 4.2 Understand the purpose of parameters for a function in Python. (Proficiency Level: B)
    • MSB 4.3 Understand how return values are used in a function in Python. (Proficiency Level: B)
    • MSB 4.4 Understand how to implement a function that returns multiple values in Python. (Proficiency Level: B)
  • LO 5 Describe the purpose and use of lambda functions in Python. (Proficiency Level: B)

Performance Objectives (Proficiency Level: 3c)

  • Conditions: Given access to (references, tools, etc.):

    • Access to specified remote virtual environment
    • Student Guide and Lab Guide
    • Student Notes
  • Performance/Behavior Tasks:

    • Write a program to parse command line arguments in Python.
    • Write a program to return multiples values in Python.
    • Write a program to receive input parameters in Python.
    • Create and implement functions to meet a requirement in Python.
  • Standard(s)

    • Criteria: Demonstration: Correctable to 100% in class
    • Evaluation: Students will have 4 hours to complete the timed evaluation consisting of both cognitive and performance components.
    • Minimum passing score is 80%

References

  1. https://pythonbasics.org/scope/
  2. https://pythonspot.com/recursion/
  3. https://realpython.com/python-lambda/
  4. https://realpython.com/python-thinking-recursively/
  5. https://www.digitalocean.com/community/tutorials/how-to-define-functions-in-python-3
  6. https://www.programiz.com/python-programming/closure
  7. https://www.programiz.com/python-programming/generator
  8. https://www.w3schools.com/PYTHON/python_scope.asp
  9. https://www.w3schools.com/python/python_iterators.asp
  10. https://www.w3schools.com/python/python_lambda.asp