Sep 16: Variable Scope, Docstrings
Learning Objectives
After today's class, you should be able to:
- Explain the difference between global and local variables.
- Write a docstring for a function (following Google's Style).
- Use
help()
to explore modules and functions in a shell.
Announcements¶
- Feedback on Gradescope
[5 min]
- See Quiz1 (written + coding)
- Due tomorrow
- Practice Quiz 2 on Wednesday
- This Friday: What is CS Research?
Return Examples¶
- Run in Python Tutor
[5 min]
returns.py | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
|
Bank of JMU Lab¶
Highlights:
- Thonny debugger's with functions
- Functions that modify parameters
- Writing docstrings for functions
- Using the built-in
help()
function