Two files sit in the same folder. The first is a module, counter.py, and the second is the program main.py.
counter.py:
total = 0
def bump():
global total
total += 1
return total
main.py:
import counter
from counter import total, bump
import counter as c
bump()
c.bump()
print(total, counter.total, c is counter)
What does main.py print?
Log in to join the discussion.
Loading…