Skip to content

Commit 73204e5

Browse files
committed
added answer file for PYTHON Modules exercises
1 parent 6842566 commit 73204e5

File tree

4 files changed

+41
-0
lines changed

4 files changed

+41
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
"""
2+
from PYTHON Modules: Exercise 1 ( https://www.w3schools.com/python/exercise.asp?filename=exercise_modules1 )
3+
4+
question:
5+
What is the correct syntax to import a module named "mymodule"?
6+
7+
______ mymodule
8+
"""
9+
import mymodule
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
"""
2+
from PYTHON Modules: Exercise 2 ( https://www.w3schools.com/python/exercise.asp?filename=exercise_modules2 )
3+
4+
question:
5+
If you want to refer to a module by using a different name, you can create an alias.
6+
What is the correct syntax for creating an alias for a module?
7+
8+
import mymodule __ mx
9+
"""
10+
import mymodule as mx
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
"""
2+
from PYTHON Modules: Exercise 3 ( https://www.w3schools.com/python/exercise.asp?filename=exercise_modules3 )
3+
4+
question:
5+
What is the correct syntax of printing all variables and function names of the "mymodule" module?
6+
7+
import mymodule
8+
9+
print(_____________)
10+
"""
11+
import mymodule
12+
13+
print(dir(mymodule))
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
"""
2+
from PYTHON Modules: Exercise 4 ( https://www.w3schools.com/python/exercise.asp?filename=exercise_modules4 )
3+
4+
question:
5+
What is the correct syntax of importing only the person1 dictionary of the "mymodule" module?
6+
7+
____ mymodule ______ person1
8+
"""
9+
from mymodule import person1

0 commit comments

Comments
 (0)