Correct Answers
Which syntax will import the function named powerful from the module named helpers
contained in the package named lessons?
Choice 1 of 3:import powerful from lessons.helpersChoice 2 of 3:from lessons.helpers
import powerfulChoice 3 of 3:from powerful import lessons.helpers - Answer-from
lessons.helpers import powerful
For the following examples, you'll be importing the following module named a contained
in the package named b:
def double(x: int) -> int: return x * 2 def double_display(y: int): print(y * 2)
double_display(2) if __name__ == "__main__": print(double(3))
Say we defined the module module named c contained in the package named b in the
following way:
from b.a import double, double_display print(double(1)) double_display(4)
What is the output after running python -m b.c?
Choice 1 of 5:2, 8 (With commas representing a new line.)Choice 2 of 5:2, 4, 8 (With
commas representing a new line.)Choice 3 of 5:4, 2, 8 (With commas representing a
new line.)Choice 4 of 5:NoneChoice 5 of 5:Error - Answer-4, 2, 8
You can directly and efficiently lookup a key by its value in a dictionary.
True or False - Answer-False
Dictionary objects are stored in which part of memory?
Choice 1 of 2:stackChoice 2 of 2:heap - Answer-heap
True/False - Dictionaries, like lists, are reference types. This means variables assigned
dictionaries are actually assigned references to the dictionary. - Answer-True
A function can return a reference to a dictionary object. True or False - Answer-True
Suppose your test subject(s) (the function(s) you are working on) are contained in a
directory named lessons and a file named subjects.py. Imagine the function you are
working on is named example_function.
How would you import the function into your tests file?
Choice 1 of 2:from lessons.subjects import example_functionChoice 2 of 2:from
lessons/subjects.py import example_function - Answer-from lessons.subjects import
example_function