Python 3.13.2 (tags/v3.13.2:4f8bb39, Feb  4 2025, 15:23:48) [MSC v.1942 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
round(123.456,1)
123.5
a = round(123.456,1)
b = round(123.456, 0)
a
123.5
b
123.0
type(a);type(b)
<class 'float'>
<class 'float'>
round(123.456)
123
c = round(123.456)
type(c)
<class 'int'>



gg=range(76,123,9)
gg
range(76, 123, 9)
list(gg)
[76, 85, 94, 103, 112, 121]
range(23)
range(0, 23)
list(range(23))
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22]



qq = ['Khatiukhin','Shabatov','Efremov','Turovec']
qq
['Khatiukhin', 'Shabatov', 'Efremov', 'Turovec']
ff = zip(gg,qq)
ff
<zip object at 0x000001D9754CB040>
tuple(ff)
((76, 'Khatiukhin'), (85, 'Shabatov'), (94, 'Efremov'), (103, 'Turovec'))
ff[1]
Traceback (most recent call last):
  File "<pyshell#25>", line 1, in <module>
    ff[1]
TypeError: 'zip' object is not subscriptable


fff=float(input('коэффициент усиления=')); dan=eval('5*fff-156')
коэффициент усиления=40
dan
44.0



KeyboardInterrupt

exec(input('введите инструкции:'))
введите инструкции:perem=-123.456;gg=round(abs(perem)+98,3)
gg
221.456



abs(-2)
2
len('jhb')
3
max(1,2)
2
min(1,2)
1
pow(2,3
    )
8
pow(2,3,4)
0
pow(2,3,3)
2
sum([1,2])
3
divmod(10,4)
(2, 2)
list(map(lambda x: x**2, [1,2,3,4,5]))
[1, 4, 9, 16, 25]



import math
dir(math)
['__doc__', '__loader__', '__name__', '__package__', '__spec__', 'acos', 'acosh', 'asin', 'asinh', 'atan', 'atan2', 'atanh', 'cbrt', 'ceil', 'comb', 'copysign', 'cos', 'cosh', 'degrees', 'dist', 'e', 'erf', 'erfc', 'exp', 'exp2', 'expm1', 'fabs', 'factorial', 'floor', 'fma', 'fmod', 'frexp', 'fsum', 'gamma', 'gcd', 'hypot', 'inf', 'isclose', 'isfinite', 'isinf', 'isnan', 'isqrt', 'lcm', 'ldexp', 'lgamma', 'log', 'log10', 'log1p', 'log2', 'modf', 'nan', 'nextafter', 'perm', 'pi', 'pow', 'prod', 'radians', 'remainder', 'sin', 'sinh', 'sqrt', 'sumprod', 'tan', 'tanh', 'tau', 'trunc', 'ulp']
help(math.factorial)
Help on built-in function factorial in module math:

factorial(n, /)
    Find n!.

    Raise a ValueError if x is negative or non-integral.

math.factorial(5)
120
math.sin(0.5)
0.479425538604203
math.acos(0.5)
1.0471975511965979
math.degrees(0.55)
31.51267873219528
math.radians(30)
0.5235987755982988
math.exp(1)
2.718281828459045
math.log(10)
2.302585092994046
math.log10(10)
1.0
math.sqrt(25)
5.0
math.ceil(4.3)
5
math.floor(4.8)
4
math.pi
3.141592653589793
math.sin((2*math.pi)/7+math.exp(0.23))
0.8334902641414562


import cmath
dir(cmath)
['__doc__', '__loader__', '__name__', '__package__', '__spec__', 'acos', 'acosh', 'asin', 'asinh', 'atan', 'atanh', 'cos', 'cosh', 'e', 'exp', 'inf', 'infj', 'isclose', 'isfinite', 'isinf', 'isnan', 'log', 'log10', 'nan', 'nanj', 'phase', 'pi', 'polar', 'rect', 'sin', 'sinh', 'sqrt', 'tan', 'tanh', 'tau']
cmath.sqrt(1.2-0.5j)
(1.118033988749895-0.22360679774997896j)
cmath.phase(1-0.5j)
-0.4636476090008061



import random
dir(random)
['BPF', 'LOG4', 'NV_MAGICCONST', 'RECIP_BPF', 'Random', 'SG_MAGICCONST', 'SystemRandom', 'TWOPI', '_ONE', '_Sequence', '__all__', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', '_accumulate', '_acos', '_bisect', '_ceil', '_cos', '_e', '_exp', '_fabs', '_floor', '_index', '_inst', '_isfinite', '_lgamma', '_log', '_log2', '_os', '_parse_args', '_pi', '_random', '_repeat', '_sha512', '_sin', '_sqrt', '_test', '_test_generator', '_urandom', 'betavariate', 'binomialvariate', 'choice', 'choices', 'expovariate', 'gammavariate', 'gauss', 'getrandbits', 'getstate', 'lognormvariate', 'main', 'normalvariate', 'paretovariate', 'randbytes', 'randint', 'random', 'randrange', 'sample', 'seed', 'setstate', 'shuffle', 'triangular', 'uniform', 'vonmisesvariate', 'weibullvariate']
help(random.seed)
Help on method seed in module random:

seed(a=None, version=2) method of random.Random instance
    Initialize internal state from a seed.

    The only supported seed types are None, int, float,
    str, bytes, and bytearray.

    None or no argument seeds from current time or from an operating
    system specific randomness source if available.

    If *a* is an int, all bits are used.

    For version 2 (the default), all of the bits are used if *a* is a str,
    bytes, or bytearray.  For version 1 (provided for reproducing random
    sequences from older versions of Python), the algorithm for str and
    bytes generates a narrower range of seeds.

random.seed
<bound method Random.seed of <random.Random object at 0x000001D9756DE570>>
random.seed()
r = random.random()
r
0.6274277749743772
u = random.uniform(1, 10)
u
8.795217202035065
rnd = random.randint(1, 10)
rnd
4
g = random.gauss(0,5)
g
-10.142595842458078
g = random.gauss(0,1)
g
-1.2762551362834256
ls = ['a','b','c','d']
ch = random.choice(ls)
ch
'a'
sh = random.shuffle(ls)
sh
random.shuffle(ls)
ls
['d', 'c', 'a', 'b']
s = random.sample(ls,3)
s
['c', 'b', 'd']
b = random.batavariate(2, 5)
Traceback (most recent call last):
  File "<pyshell#102>", line 1, in <module>
    b = random.batavariate(2, 5)
AttributeError: module 'random' has no attribute 'batavariate'. Did you mean: 'betavariate'?
b = random.betavariate(2, 5)
b
0.2662037969664268
g = random.gammavariate(2,2)
g
4.673121545436751
rnd_ls = [random.uniform(1, 10), random.gauss(5, 2), random.betavariate(2, 5),  random.gammavariate(2, 2)]
rnd_ls
[4.085707425290092, 5.648252018761857, 0.05544308773047868, 5.588311173368095]

import time
dir(time)
['_STRUCT_TM_ITEMS', '__doc__', '__loader__', '__name__', '__package__', '__spec__', 'altzone', 'asctime', 'ctime', 'daylight', 'get_clock_info', 'gmtime', 'localtime', 'mktime', 'monotonic', 'monotonic_ns', 'perf_counter', 'perf_counter_ns', 'process_time', 'process_time_ns', 'sleep', 'strftime', 'strptime', 'struct_time', 'thread_time', 'thread_time_ns', 'time', 'time_ns', 'timezone', 'tzname']
c1=time.time()
c1
1760259525.185354
c2=time.time()-c1
c2
12.37006688117981
dat=time.gmtime()
dat
time.struct_time(tm_year=2025, tm_mon=10, tm_mday=12, tm_hour=8, tm_min=59, tm_sec=20, tm_wday=6, tm_yday=285, tm_isdst=0)
dat.tm_mon
10
dat.tm_year
2025
dat.tm_min
59
tm = time.localtime()
tm
time.struct_time(tm_year=2025, tm_mon=10, tm_mday=12, tm_hour=12, tm_min=20, tm_sec=40, tm_wday=6, tm_yday=285, tm_isdst=0)
time.asctime()
'Sun Oct 12 12:21:46 2025'
time.ctime()
'Sun Oct 12 12:21:56 2025'
time.sleep(5)
ti
time.mktime(tm)
1760260840.0
time.localtime(c1)
time.struct_time(tm_year=2025, tm_mon=10, tm_mday=12, tm_hour=11, tm_min=58, tm_sec=45, tm_wday=6, tm_yday=285, tm_isdst=0)





import pylab
Traceback (most recent call last):
  File "<pyshell#23>", line 1, in <module>
    import pylab
ModuleNotFoundError: No module named 'pylab'
import sys
sys.path.append('C:\\Users\\Евгений\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Python 3.13\\lib\\site-packages')
import pylab
Traceback (most recent call last):
  File "<pyshell#26>", line 1, in <module>
    import pylab
ModuleNotFoundError: No module named 'pylab'
sys.path
['', 'C:\\Users\\Евгений\\AppData\\Local\\Programs\\Python\\Python313\\Lib\\idlelib', 'C:\\Users\\Евгений\\AppData\\Local\\Programs\\Python\\Python313\\python313.zip', 'C:\\Users\\Евгений\\AppData\\Local\\Programs\\Python\\Python313\\DLLs', 'C:\\Users\\Евгений\\AppData\\Local\\Programs\\Python\\Python313\\Lib', 'C:\\Users\\Евгений\\AppData\\Local\\Programs\\Python\\Python313', 'C:\\Users\\Евгений\\AppData\\Local\\Programs\\Python\\Python313\\Lib\\site-packages', 'C:\\Users\\Евгений\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Python 3.13\\lib\\site-packages']
sys.path.append('C:\\Users\\Евгений\\AppData\\Local\\Programs\\Python\\Python313\\Lib\\site-packages')
import pylab
Traceback (most recent call last):
  File "<pyshell#29>", line 1, in <module>
    import pylab
ModuleNotFoundError: No module named 'pylab'
py -m site
SyntaxError: invalid syntax
sys.path
['', 'C:\\Users\\Евгений\\AppData\\Local\\Programs\\Python\\Python313\\Lib\\idlelib', 'C:\\Users\\Евгений\\AppData\\Local\\Programs\\Python\\Python313\\python313.zip', 'C:\\Users\\Евгений\\AppData\\Local\\Programs\\Python\\Python313\\DLLs', 'C:\\Users\\Евгений\\AppData\\Local\\Programs\\Python\\Python313\\Lib', 'C:\\Users\\Евгений\\AppData\\Local\\Programs\\Python\\Python313', 'C:\\Users\\Евгений\\AppData\\Local\\Programs\\Python\\Python313\\Lib\\site-packages', 'C:\\Users\\Евгений\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Python 3.13\\lib\\site-packages', 'C:\\Users\\Евгений\\AppData\\Local\\Programs\\Python\\Python313\\Lib\\site-packages']
sys.path.append('C:\\Users\\Евгений\\AppData\\Local\\Programs\\Python\\Python313\\lib\\site-packages')
import pylab
Traceback (most recent call last):
  File "<pyshell#33>", line 1, in <module>
    import pylab
ModuleNotFoundError: No module named 'pylab'
import pylab












import pylab
x=list(range(-3,55,4))
x
[-3, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53]
t=list(range(15))
t
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
pylab.plot(t,x)  #Создание графика в оперативной памяти
[<matplotlib.lines.Line2D object at 0x000002CD3BC6EC10>]
pylab.title('Первый график')
Text(0.5, 1.0, 'Первый график')
pylab.xlabel('время')
Text(0.5, 0, 'время')
pylab.ylabel('сигнал')
Text(0, 0.5, 'сигнал')
pylab.show() #Отображение графика на экране

pylab.show() #Отображение графика на экране

pylab.title('Первый график')
Text(0.5, 1.0, 'Первый график')
pylab.xlabel('время')
Text(0.5, 0, 'время')
pylab.ylabel('сигнал')
Text(0, 0.5, 'сигнал')
pylab.show() #Отображение графика на экране
SyntaxError: multiple statements found while compiling a single statement
pylab.plot(t,x)  #Создание графика в оперативной памяти
[<matplotlib.lines.Line2D object at 0x000002CD3BC6EC10>]
pylab.title('Первый график')
Text(0.5, 1.0, 'Первый график')
pylab.xlabel('время')
Text(0.5, 0, 'время')
pylab.ylabel('сигнал')
Text(0, 0.5, 'сигнал')
pylab.show() #Отображение графика на экране
SyntaxError: multiple statements found while compiling a single statement


X1=[12,6,8,10,7];X2=[5,7,9,11,13]
X1
[12, 6, 8, 10, 7]
X2
[5, 7, 9, 11, 13]
pylab.plot(X1)
[<matplotlib.lines.Line2D object at 0x000002CD3CD6F4D0>]
pylab.plot(X2)
[<matplotlib.lines.Line2D object at 0x000002CD3CD6F610>]
pylab.show()


region=['Центр','Урал','Сибирь','Юг']  #Метки для диаграммы
naselen=[65,12,23,17]  # Значения для диаграммы
pylab.pie(naselen,labels=region) #Создание диаграммы в памяти
([<matplotlib.patches.Wedge object at 0x000002CD3BD38050>, <matplotlib.patches.Wedge object at 0x000002CD3CE14F50>, <matplotlib.patches.Wedge object at 0x000002CD3CE15310>, <matplotlib.patches.Wedge object at 0x000002CD3CE15590>], [Text(-0.191013134139045, 1.0832885038559115, 'Центр'), Text(-0.861328292412156, -0.6841882582231001, 'Урал'), Text(0.04429273995539947, -1.0991078896938387, 'Сибирь'), Text(0.9873750693480946, -0.48486129194837324, 'Юг')])
pylab.show()  #Отображение диаграммы


pylab.plot(X1)
[<matplotlib.lines.Line2D object at 0x000002CD3CA98CD0>]
pylab.plot(X2)
[<matplotlib.lines.Line2D object at 0x000002CD3CA98E10>]
pylab.show()


ls = [1, 1, 5, 5, 2, 3, 3, 3, 2, 4, 4]
pylab.hist(ls, bins=5)
(array([2., 2., 3., 2., 2.]), array([1. , 1.8, 2.6, 3.4, 4.2, 5. ]), <BarContainer object of 5 artists>)
pylab.title('Гистограмма')
Text(0.5, 1.0, 'Гистограмма')
pylab.show()
ls = [1, 5, 2, 3, 3, 3, 2, 4, 4]
ls = [1, 5, 2, 3, 3, 3, 2, 4, 4, 3]
pylab.hist(ls, bins=5)
(array([1., 2., 4., 2., 1.]), array([1. , 1.8, 2.6, 3.4, 4.2, 5. ]), <BarContainer object of 5 artists>)
pylab.title('Гистограмма')
Text(0.5, 1.0, 'Гистограмма')
pylab.show()


a = ['One', 'Two', 'Three']
b = [20, 50, 25]
pylab.bar(a, b)
<BarContainer object of 3 artists>
pylab.title("Столбиковая диаграмма")
Text(0.5, 1.0, 'Столбиковая диаграмма')
pylab.show()


import statistics
dir(statistics)
['Counter', 'Decimal', 'Fraction', 'LinearRegression', 'NormalDist', 'StatisticsError', '_SQRT2', '__all__', '__annotations__', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', '_coerce', '_convert', '_decimal_sqrt_of_frac', '_exact_ratio', '_fail_neg', '_float_sqrt_of_frac', '_integer_sqrt_of_frac_rto', '_isfinite', '_kernel_invcdfs', '_mean_stdev', '_newton_raphson', '_normal_dist_inv_cdf', '_quartic_invcdf', '_quartic_invcdf_estimate', '_random', '_rank', '_sqrt_bit_width', '_sqrtprod', '_ss', '_sum', '_triweight_invcdf', '_triweight_invcdf_estimate', 'acos', 'asin', 'atan', 'bisect_left', 'bisect_right', 'correlation', 'cos', 'cosh', 'count', 'covariance', 'defaultdict', 'erf', 'exp', 'fabs', 'fmean', 'fsum', 'geometric_mean', 'groupby', 'harmonic_mean', 'hypot', 'isfinite', 'isinf', 'itemgetter', 'kde', 'kde_random', 'linear_regression', 'log', 'math', 'mean', 'median', 'median_grouped', 'median_high', 'median_low', 'mode', 'multimode', 'namedtuple', 'numbers', 'pi', 'pstdev', 'pvariance', 'quantiles', 'random', 'reduce', 'repeat', 'sin', 'sqrt', 'stdev', 'sumprod', 'sys', 'tan', 'tau', 'variance']
mean = statistics.mean(ls)
mean
3
med = statistic.median(ls)
Traceback (most recent call last):
  File "<pyshell#105>", line 1, in <module>
    med = statistic.median(ls)
NameError: name 'statistic' is not defined. Did you mean: 'statistics'?
med = statistics.median(ls)
med
3.0
mode = statistics.mode(ls)
mode
3
