1
2
3
4
5
6
7
8
9
10
11
12
To practice on your own, or to check code you believe shouldn't have been scored as incorrect, go to Trinket.
Post a review on Amazon for the paperback or the Kindle edition.
Email me to give me a compliment, complaint, or correction. I'll respond.
0,1,2,3,4,5,6,7,8,9,10,11
0
0
0
0
A Python program that stores functions that you can access from other Python programs is called a _____________ | module | ^ *module *$ | |
To use functions stored in a module, you must _______ the module. | import | ^ *import *$ | |
The name of a module must end in _____. | .py | .`py | |
Rewrite this import statement so it's legal. | import calc.py | import calc | import calc |
Rewrite this import statement so it's legal. | import "functions.py" | import functions | ^ *import functions *$ |
Code an import statement. Make up the name of the module. | import math | ^ *import [a-zA-Z_][a-zA-Z0-9_]* *$ | |
Call the function add_tax in the calculations module. | calculations.add_tax() | ^ *calculations\.add_tax\(\) *$ | |
Call a function in a module. Make everything up. | calculations.add_tax() | ^ *[a-zA-Z_][a-zA-Z0-9_]*\.[a-zA-Z_][a-zA-Z0-9_]*\(\) *$ | |
Import a module. Then call a function in the module. Make everything up. | import calculations calculations.add_tax() |
^ *import ([a-zA-Z_][a-zA-Z0-9_]*)\n\1\.[a-zA-Z_][a-zA-Z0-9_]*\(\) *$ | |
|
def add_em(first_number, second_number): return first_number + second_number total = calculations.add_em(133, 102) |
^ *def ([a-zA-Z_][a-zA-Z0-9_]*)\(([a-zA-Z_][a-zA-Z0-9_]*), ([a-zA-Z_][a-zA-Z0-9_]*)\):\n return \2 \+ \3\n[a-zA-Z_][a-zA-Z0-9_]* = [a-zA-Z_][a-zA-Z0-9_]*\.\1\(-?[0-9]+, -?[0-9]+\) *$ | |
|
|||