Vidyalelo
Python · Q46

Module in Python

Programming · Python · question 46

Q46

How can you prevent a module from executing code when imported?

A.
By using the if __name__ == "__main__": construct
Answer
B.
By using the noexec keyword
C.
By using the prevent_execute decorator
D.
By using the not_executed function

Answer: Option A

Solution

Answer: Option A
No explanation is given for this question Let's Discuss on Board