You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**Question 1:** You want to prevent your module's user from running your code as an ordinary script. How will you achieve such an effect?
8
+
9
+
<details>
10
+
<summary>Check</summary>
11
+
12
+
```
13
+
import sys
14
+
15
+
if __name__ == "__main__":
16
+
print "Don't do that!"
17
+
sys.exit()
18
+
```
19
+
</details>
20
+
21
+
---
22
+
23
+
**Question 2:** Some additional and necessary packages are stored inside the <code>D:\Python\Project\Modules</code> directory. Write a code ensuring that the directory is traversed by Python in order to find all requested modules.
24
+
25
+
```
26
+
import sys
27
+
28
+
# note the double backslashes!
29
+
sys.path.append("D:\\Python\\Project\\Modules")
30
+
31
+
```
32
+
33
+
Assuming that <code>D:\Python\Project\Modules</code> has been successfully appended to the `sys.path` list, write an import directive letting you use all the `mymodule` entities.
34
+
35
+
<details>
36
+
<summary>Check</summary>
37
+
38
+
```
39
+
import sys
40
+
41
+
# note the double backslashes!
42
+
sys.path.append("D:\\Python\\Project\\Modules")
43
+
```
44
+
</details>
45
+
46
+
---
47
+
48
+
**Question 3:** The directory mentioned in the previous exercise contains a sub-tree of the following structure:
0 commit comments