Test modules.

This commit is contained in:
Captain ALM 2022-11-30 19:59:03 +00:00
parent 8fc8c48ff3
commit d6c6b781d5
Signed by: alfred
GPG Key ID: 4E4ADD02609997B1
3 changed files with 14 additions and 24 deletions

Binary file not shown.

32
main.py
View File

@ -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())

6
mymodule.py Normal file
View File

@ -0,0 +1,6 @@
def greeting(inpt):
print(f"Hello {inpt}!")
author = "Alfred"
def foo():
print("Foo Fighters!")
return "Bar"