Certified Associate in Python Programming (PCAP-31-03) — Question 101
A Python module named pymod.py contains a function named pyfun().
Which of the following snippets will let you invoke the function? (Choose two.)
Answer options
- A. from pymod import * pymod.pyfun()
- B. import pyfun from pymod pyfun()
- C. import pymod pymod.pyfun()
- D. from pymod import pyfun pyfun()
Correct answer: C, D
Explanation
Options C and D are correct because they properly import the pymod module and the pyfun function, allowing the function to be called directly. Option A incorrectly tries to call pymod.pyfun() after using a wildcard import, and option B uses incorrect syntax for importing the function.