diff --git a/TEMA8/report.md b/TEMA8/report.md index d534529..7d30f94 100644 --- a/TEMA8/report.md +++ b/TEMA8/report.md @@ -11,10 +11,15 @@ ```py + >>> import os,sys,importlib + >>> os.chdir(r'C:\\Users\\uprkt\\Desktop\\ПО\\python-labs\\TEMA8') + >>> os.getcwd() + 'C:\\\\Users\\\\uprkt\\\\Desktop\\\\ПО\\\\python-labs\\\\TEMA8' + ``` @@ -28,18 +33,31 @@ ```py + >>> import Mod1 + Mod1:Введите значение = 5 + Mod1:Значение perm1= 5 + >>> Mod1.perm1 + '5' + >>> import Mod1 + >>> importlib.reload(Mod1) + Mod1:Введите значение = 3 + Mod1:Значение perm1= 3 + + >>> Mod1.perm1 + '3' + ``` @@ -49,19 +67,33 @@ Mod1:Значение perm1= 3 ```py + >>> print(sorted(sys.modules.keys())) + \\\['Mod1', '\\\_\\\_future\\\_\\\_', '\\\_\\\_main\\\_\\\_', '\\\_abc', '\\\_ast', '\\\_bisect', '\\\_bz2', '\\\_codecs', '\\\_collections', '\\\_collections\\\_abc', '\\\_colorize', '\\\_compat\\\_pickle', '\\\_compression', '\\\_datetime', '\\\_frozen\\\_importlib', '\\\_frozen\\\_importlib\\\_external', '\\\_functools', '\\\_heapq', '\\\_imp', '\\\_io', '\\\_lzma', '\\\_opcode', '\\\_opcode\\\_metadata', '\\\_operator', '\\\_pickle', '\\\_pyrepl', '\\\_pyrepl.pager', '\\\_queue', '\\\_random', '\\\_signal', '\\\_sitebuiltins', '\\\_socket', '\\\_sre', '\\\_stat', '\\\_string', '\\\_struct', '\\\_sysconfig', '\\\_thread', '\\\_tkinter', '\\\_tokenize', '\\\_typing', '\\\_warnings', '\\\_weakref', '\\\_weakrefset', '\\\_winapi', '\\\_wmi', 'abc', 'ast', 'bdb', 'binascii', 'bisect', 'builtins', 'bz2', 'codecs', 'collections', 'collections.abc', 'configparser', 'contextlib', 'copyreg', 'datetime', 'dis', 'encodings', 'encodings.aliases', 'encodings.cp1251', 'encodings.utf\\\_8', 'enum', 'errno', 'fnmatch', 'functools', 'genericpath', 'heapq', 'idlelib', 'idlelib.autocomplete', 'idlelib.autocomplete\\\_w', 'idlelib.calltip', 'idlelib.calltip\\\_w', 'idlelib.config', 'idlelib.debugger', 'idlelib.debugger\\\_r', 'idlelib.debugobj', 'idlelib.debugobj\\\_r', 'idlelib.hyperparser', 'idlelib.iomenu', 'idlelib.macosx', 'idlelib.multicall', 'idlelib.pyparse', 'idlelib.rpc', 'idlelib.run', 'idlelib.scrolledlist', 'idlelib.stackviewer', 'idlelib.tooltip', 'idlelib.tree', 'idlelib.util', 'idlelib.window', 'idlelib.zoomheight', 'importlib', 'importlib.\\\_abc', 'importlib.\\\_bootstrap', 'importlib.\\\_bootstrap\\\_external', 'importlib.machinery', 'importlib.util', 'inspect', 'io', 'ipaddress', 'itertools', 'keyword', 'linecache', 'lzma', 'marshal', 'math', 'nt', 'ntpath', 'opcode', 'operator', 'os', 'os.path', 'pickle', 'pkgutil', 'platform', 'plistlib', 'posixpath', 'pydoc', 'pyexpat', 'pyexpat.errors', 'pyexpat.model', 'queue', 'random', 're', 're.\\\_casefix', 're.\\\_compiler', 're.\\\_constants', 're.\\\_parser', 'reprlib', 'select', 'selectors', 'shlex', 'shutil', 'site', 'socket', 'socketserver', 'stat', 'string', 'struct', 'sys', 'sysconfig', 'tempfile', 'textwrap', 'threading', 'time', 'tkinter', 'tkinter.constants', 'token', 'tokenize', 'traceback', 'types', 'typing', 'urllib', 'urllib.parse', 'warnings', 'weakref', 'winreg', 'xml', 'xml.parsers', 'xml.parsers.expat', 'xml.parsers.expat.errors', 'xml.parsers.expat.model', 'zipimport', 'zlib'] + >>> sys.modules.pop('Mod1') + + >>> print(sorted(sys.modules.keys())) + \\\['\\\_\\\_future\\\_\\\_', '\\\_\\\_main\\\_\\\_', '\\\_abc', '\\\_ast', '\\\_bisect', '\\\_bz2', '\\\_codecs', '\\\_collections', '\\\_collections\\\_abc', '\\\_colorize', '\\\_compat\\\_pickle', '\\\_compression', '\\\_datetime', '\\\_frozen\\\_importlib', '\\\_frozen\\\_importlib\\\_external', '\\\_functools', '\\\_heapq', '\\\_imp', '\\\_io', '\\\_lzma', '\\\_opcode', '\\\_opcode\\\_metadata', '\\\_operator', '\\\_pickle', '\\\_pyrepl', '\\\_pyrepl.pager', '\\\_queue', '\\\_random', '\\\_signal', '\\\_sitebuiltins', '\\\_socket', '\\\_sre', '\\\_stat', '\\\_string', '\\\_struct', '\\\_sysconfig', '\\\_thread', '\\\_tkinter', '\\\_tokenize', '\\\_typing', '\\\_warnings', '\\\_weakref', '\\\_weakrefset', '\\\_winapi', '\\\_wmi', 'abc', 'ast', 'bdb', 'binascii', 'bisect', 'builtins', 'bz2', 'codecs', 'collections', 'collections.abc', 'configparser', 'contextlib', 'copyreg', 'datetime', 'dis', 'encodings', 'encodings.aliases', 'encodings.cp1251', 'encodings.utf\\\_8', 'enum', 'errno', 'fnmatch', 'functools', 'genericpath', 'heapq', 'idlelib', 'idlelib.autocomplete', 'idlelib.autocomplete\\\_w', 'idlelib.calltip', 'idlelib.calltip\\\_w', 'idlelib.config', 'idlelib.debugger', 'idlelib.debugger\\\_r', 'idlelib.debugobj', 'idlelib.debugobj\\\_r', 'idlelib.hyperparser', 'idlelib.iomenu', 'idlelib.macosx', 'idlelib.multicall', 'idlelib.pyparse', 'idlelib.rpc', 'idlelib.run', 'idlelib.scrolledlist', 'idlelib.stackviewer', 'idlelib.tooltip', 'idlelib.tree', 'idlelib.util', 'idlelib.window', 'idlelib.zoomheight', 'importlib', 'importlib.\\\_abc', 'importlib.\\\_bootstrap', 'importlib.\\\_bootstrap\\\_external', 'importlib.machinery', 'importlib.util', 'inspect', 'io', 'ipaddress', 'itertools', 'keyword', 'linecache', 'lzma', 'marshal', 'math', 'nt', 'ntpath', 'opcode', 'operator', 'os', 'os.path', 'pickle', 'pkgutil', 'platform', 'plistlib', 'posixpath', 'pydoc', 'pyexpat', 'pyexpat.errors', 'pyexpat.model', 'queue', 'random', 're', 're.\\\_casefix', 're.\\\_compiler', 're.\\\_constants', 're.\\\_parser', 'reprlib', 'select', 'selectors', 'shlex', 'shutil', 'site', 'socket', 'socketserver', 'stat', 'string', 'struct', 'sys', 'sysconfig', 'tempfile', 'textwrap', 'threading', 'time', 'tkinter', 'tkinter.constants', 'token', 'tokenize', 'traceback', 'types', 'typing', 'urllib', 'urllib.parse', 'warnings', 'weakref', 'winreg', 'xml', 'xml.parsers', 'xml.parsers.expat', 'xml.parsers.expat.errors', 'xml.parsers.expat.model', 'zipimport', 'zlib'] + import Mod1 + Mod1:Введите значение = 2 + Mod1:Значение perm1= 2 + Mod1.perm1 + '2' + sys.modules.pop('Mod1') + + ``` @@ -71,23 +103,41 @@ sys.modules.pop('Mod1') ```py + >>> exec(open('Mod1.py').read()) + Mod1:Введите значение = 6 + Mod1:Значение perm1= 6 + >>> Mod1.perm1 + '2' + >>> perm1 + '6' + >>> exec(open('Mod1.py').read()) + Mod1:Введите значение = 7 + Mod1:Значение perm1= 7 + >>> perm1 + '7' + >>> exec(open('Mod1.py').read()) + Mod1:Введите значение = 8 + Mod1:Значение perm1= 8 + >>> perm1 + '8' + ``` @@ -97,39 +147,73 @@ Mod1:Значение perm1= 8 ```py + >>> from Mod1 import perm1 + Mod1:Введите значение = 9 + Mod1:Значение perm1= 9 + >>> perm1 + '9' + >>> dir() + \\\['Mod1', '\\\_\\\_annotations\\\_\\\_', '\\\_\\\_builtins\\\_\\\_', '\\\_\\\_doc\\\_\\\_', '\\\_\\\_loader\\\_\\\_', '\\\_\\\_name\\\_\\\_', '\\\_\\\_package\\\_\\\_', '\\\_\\\_spec\\\_\\\_', '\\\_\\\_warningregistry\\\_\\\_', 'importlib', 'os', 'perm1', 'sys'] + >>> from Mod2 import beta + >>> g=beta(2) + >>> g + 535.4916555247646 + >>> dir() + \\\['Mod1', '\\\_\\\_annotations\\\_\\\_', '\\\_\\\_builtins\\\_\\\_', '\\\_\\\_doc\\\_\\\_', '\\\_\\\_loader\\\_\\\_', '\\\_\\\_name\\\_\\\_', '\\\_\\\_package\\\_\\\_', '\\\_\\\_spec\\\_\\\_', '\\\_\\\_warningregistry\\\_\\\_', 'beta', 'g', 'importlib', 'os', 'perm1', 'sys'] + >>> alpha() + Traceback (most recent call last): + File "", line 1, in + alpha() + NameError: name 'alpha' is not defined + >>> from Mod2 import alpha as al + >>> al() + \*\*\*\*ALPHA\*\*\*\* + Значение t=5 + '5' + >>> del al,beta + >>> from Mod2 import alpha as al, beta as bt + >>> del al,bt + >>> from Mod2 import \* + >>> tt=alpha() + \*\*\*\*ALPHA\*\*\*\* + Значение t=0.12 + >>> uu=beta(float(tt)) + >>> uu + 1.4578913609506803 + ``` @@ -143,22 +227,39 @@ NameError: name 'alpha' is not defined ```py + >>> sys.modules.pop('Mod1') + + >>> sys.modules.pop('Mod2') + + >>> import Mod0 + Mod1:Введите значение = 7 + Mod1:Значение perm1= 7 + perm1= 7 + \*\*\*\*ALPHA\*\*\*\* + Значение t=8 + tt= 8 + qq= 82226315585.59491 + >>> Mod0.tt;Mod0.qq;Mod0.Mod1.perm1 + '8' + 82226315585.59491 + '7' + ``` @@ -234,11 +335,13 @@ print('y=',MM2.vyhod) Запустим модуль MM0: ```py - import MM0 + + import MM0 k1,T,k2,Xm,A,F,N=2,10,3,1,5,0.025,30 y= \[0, 0, 0, 0, 0, 0, 0, -1.299465163446989, -1.3579959054305797, 0, 3.7144096317728987, 7.811411673609909, 6.5646766889828605, -1.7207792337901524, -18.81372872718616, -31.38046599103643, -22.278866622819873, 17.097152611947436, 77.81058529582174, 112.97718138176809, 62.60779574768801, -98.35894773519156, -309.62984734263415, -395.51094806311954, -151.2442551724449, 474.0906424325323, 1190.4363664389593, 1337.7521059074418, 237.48484712636358, -2125.064719245332] + ``` @@ -278,6 +381,7 @@ def beta(q): ```py + >>> Mod2.alpha() \*\*\*\*ALPHA\*\*\*\* @@ -289,6 +393,7 @@ def beta(q): >>> Mod2.beta(8) 82226315585.59491 + ```