Module 1¶
Module named newmodule.py
should contain this code (if you are 20 years old):
# newmodule.py
myage=20
year=2021
Module 2¶
Module named newmodule2.py
should contain this code (if you were born in 2001):
# newmodule2.py
myage=0
year=2001
import newmodule, newmodule2
print("Have I had my birthday this year yet?\n")
print((newmodule.myage - newmodule2.myage) == (newmodule.year - newmodule2.year))
Modifying an attribute of an imported module:¶
newmodule.myage -= 1
print(newmodule.myage)
print("Have I had my birthday this year yet?\n")
print((newmodule.myage - newmodule2.myage) == (newmodule.year - newmodule2.year))