From d6c6b781d5f08d84614ec2f12c365b9c1d146e93 Mon Sep 17 00:00:00 2001 From: Captain ALM Date: Wed, 30 Nov 2022 19:59:03 +0000 Subject: [PATCH] Test modules. --- __pycache__/mymodule.cpython-39.pyc | Bin 0 -> 432 bytes main.py | 32 +++++++--------------------- mymodule.py | 6 ++++++ 3 files changed, 14 insertions(+), 24 deletions(-) create mode 100644 __pycache__/mymodule.cpython-39.pyc create mode 100644 mymodule.py diff --git a/__pycache__/mymodule.cpython-39.pyc b/__pycache__/mymodule.cpython-39.pyc new file mode 100644 index 0000000000000000000000000000000000000000..daf98337dc5318b5803fadd48078d2c4cc512632 GIT binary patch literal 432 zcmYk1zfQw25XS8|2@xV217ka80Plbh{}eHGK`aqV6uW7p#ExudC_-WYiHATuKp%kj z=$w_e=)|2Xq?~l0&u4$9-<4^4NFcU9pVb?jzj&EO0GDe>djcYepdX|lA}FX}B7`~+ z(Id&?io)}MU>!oggeKG+z`4kn2N>gW09@mn6Dxi;-k)6V_qg)x*iV9x{sEMCRUZHV literal 0 HcmV?d00001 diff --git a/main.py b/main.py index 6dcd593..7c0204f 100644 --- a/main.py +++ b/main.py @@ -1,24 +1,8 @@ -#Iteration test -a = (1, 2, 3) -b = iter(a) -print(next(b)) -print(next(b)) -print(next(b)) - -class A: - def __init__(self): - self.n = 0 - def __init__(self, n): - self.n = n - def __iter__(self): - self.i = 0 - return self - def __next__(self): - if self.i > 100 or self.i < -100: raise StopIteration - z = self.i - self.i -= self.n - return z -c = A(2) -d = iter(c) -for x in d: - print(x) +#Module test +import mymodule as m +from mymodule import foo as bar +m.greeting(m.author) +import platform as plat +print(plat.system()) +print(dir(plat)) +print(bar()) diff --git a/mymodule.py b/mymodule.py new file mode 100644 index 0000000..0395ca6 --- /dev/null +++ b/mymodule.py @@ -0,0 +1,6 @@ +def greeting(inpt): + print(f"Hello {inpt}!") +author = "Alfred" +def foo(): + print("Foo Fighters!") + return "Bar"