Test your knowledge of Modules & Imports • 12 Questions
What is a Python module?
What does math.sqrt(49) return?
math.sqrt(49)
What is the difference between math.ceil(3.2) and math.floor(3.2)?
math.ceil(3.2)
math.floor(3.2)
Which of the following correctly imports only the randint function from the random module?
randint
import randint from random
import random.randint
from random import *
from random import randint
After running from math import sqrt, how do you call the square root function?
from math import sqrt
math.sqrt(16)
sqrt(16)
math::sqrt(16)
What does random.choice(["a", "b", "c"]) do?
random.choice(["a", "b", "c"])
What does import math as m do?
import math as m
m.sqrt()
math.sqrt()
m
What is pip?
What is the purpose of a requirements.txt file?
requirements.txt
What does if __name__ == "__main__": do?
if __name__ == "__main__":
What does random.shuffle(my_list) return?
random.shuffle(my_list)
Where should import statements be placed in a Python file?