Test Yourself
- Why are functions advantageous to have in your programs?
- When does the code in a function execute: when the function is defined or when the function is called?
- What statement creates a function?
- What is the difference between a function and a function call?
- How many global scopes are there in a Python program? How many local scopes?
- What happens to variables in a local scope when the function call returns?
- What is a return value? Can a return value be part of an expression?
- If a function does not have a return statement, what is the return value of a call to that function?
- How can you force a variable in a function to refer to the global variable?
- What is the data type of None?
- What does the import areallyourpetsnamederic statement do?
- If you had a function named bacon() in a module named spam, how would you call it after importing spam?
- How can you prevent a program from crashing when it gets an error?
- What goes in the try clause? What goes in the except clause?