Python_Institute
PCAP-31-03 · Question #2
A Python module named pymod.py contains a variable named pyvar. Which of the following snippets will let you access the variable?
The correct answer is A. import pyvar from pymod pyvar = 1. See the full explanation below for the reasoning.
Question
A Python module named pymod.py contains a variable named pyvar. Which of the following snippets will let you access the variable?
Options
- Aimport pyvar from pymod pyvar = 1
- Bfrom pymod import pyvar = 1
- Cfrom pymod import pyvar pyvar ()
- Dimport pymod pymod.pyvar = 1
How the community answered
(21 responses)- A86% (18)
- C10% (2)
- D5% (1)
Community Discussion
No community discussion yet for this question.