Python 7 Levels, L5, Unit 55, Modules

Powered By EmbedPress

Package folder structure:

test1 in package:

num = 10
def add(a,b):
    c = a + b
    return c

test2 in package:

'''import test1 as t
print(t.num)
c = t.add(2,3)
print(c)'''
from test1 import *
print(num)
c = add(2,3)
print(c)

test4 in package:

import time
start = time.time()
for i in range(10000):
    for j in range(10000):
        pass
end = time.time()
print(end - start)

test5 in package:

from time import sleep
print("how")
sleep(1)
print("are")
sleep(1)
print("you")

test3:

'''import package.test1 as t
print(t.num)'''

from package.test1 import num,add
print(num)
c = add(3,5)
print(c)

dahan1999

1 Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Posts