Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
Shade in the A or B circle for each question.
Draw a line connecting each item on the left to its match on the right.
| Left column | Right column | |
|---|---|---|
| 1import my module | AOk: Import specific function | |
| 2from helpers import greet() | BOutput: (defines greet in module) | |
| 3import helpers helpers.greet() | CError: Module names can't have spaces | |
| 4from helpers import greet greet() | DError: Must name what to import | |
| 5# In helpers.py: def greet(): print('Hi') | EValid: Use module prefix | |
| 6# In main.py: import helpers helpers.greet() | FOutput: Hi |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
Module — Any .py file that can be imported and reused.~~import moduleimport helpers
print(helpers.greet('Al'))from helpers import greet
print(greet('Al'))import helpers
print(helpers.greet('Alice'))if __name__ == '__main__':
print('Running directly')from helpers import add
result = add(3, 5)