|
|
Python 3.13.7 (tags/v3.13.7:bcee1c3, Aug 14 2025, 14:15:11) [MSC v.1944 64 bit (AMD64)] on win32
|
|
|
Enter "help" below or click "Help" above for more information.
|
|
|
help(round)
|
|
|
Help on built-in function round in module builtins:
|
|
|
|
|
|
round(number, ndigits=None)
|
|
|
Round a number to a given precision in decimal digits.
|
|
|
|
|
|
The return value is an integer if ndigits is omitted or None. Otherwise
|
|
|
the return value has the same type as the number. ndigits may be negative.
|
|
|
|
|
|
type(round)
|
|
|
<class 'builtin_function_or_method'>
|
|
|
range(23)
|
|
|
range(0, 23)
|
|
|
gg=range(76,123,9)
|
|
|
qq=["Снегура", "Туровец", "Хатюхин", "Шабатов"]
|
|
|
ff=zip(gg,qq)
|
|
|
tuple(ff)
|
|
|
((76, 'Снегура'), (85, 'Туровец'), (94, 'Хатюхин'), (103, 'Шабатов'))
|
|
|
a=tuple(ff)
|
|
|
a[1]
|
|
|
Traceback (most recent call last):
|
|
|
File "<pyshell#8>", line 1, in <module>
|
|
|
a[1]
|
|
|
IndexError: tuple index out of range
|
|
|
b=list(ff)
|
|
|
b[1]
|
|
|
Traceback (most recent call last):
|
|
|
File "<pyshell#10>", line 1, in <module>
|
|
|
b[1]
|
|
|
IndexError: list index out of range
|
|
|
gg
|
|
|
range(76, 123, 9)
|
|
|
tuple(gg)
|
|
|
(76, 85, 94, 103, 112, 121)
|
|
|
list(gg)
|
|
|
[76, 85, 94, 103, 112, 121]
|
|
|
c= list(zip(gg, qq))
|
|
|
c[1]
|
|
|
(85, 'Туровец')
|
|
|
exec(input('введите инструкции:'))
|
|
|
введите инструкции:perem=-123.456;gg=round(abs(perem)+98,3)
|
|
|
gg
|
|
|
221.456
|
|
|
numbers = [1, 2, 3, 4, 5]
|
|
|
list(map(str, numbers))
|
|
|
['1', '2', '3', '4', '5']
|
|
|
divmod(3,7)
|
|
|
(0, 3)
|
|
|
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!.
|
|
|
|
|
|
math.factorial(5)
|
|
|
120
|
|
|
math.sin(180)
|
|
|
-0.8011526357338304
|
|
|
heip(math.sin)
|
|
|
Traceback (most recent call last):
|
|
|
File "<pyshell#26>", line 1, in <module>
|
|
|
heip(math.sin)
|
|
|
NameError: name 'heip' is not defined. Did you mean: 'help'?
|
|
|
help(math.sin)
|
|
|
Help on built-in function sin in module math:
|
|
|
|
|
|
sin(x, /)
|
|
|
Return the sine of x (measured in radians).
|
|
|
|
|
|
help(math.acos)
|
|
|
Help on built-in function acos in module math:
|
|
|
|
|
|
acos(x, /)
|
|
|
Return the arc cosine (measured in radians) of x.
|
|
|
|
|
|
The result is between 0 and pi.
|
|
|
|
|
|
math.acos(-0.8011526357338304)
|
|
|
2.500015072176682
|
|
|
heip(math.degrees)
|
|
|
Traceback (most recent call last):
|
|
|
File "<pyshell#30>", line 1, in <module>
|
|
|
heip(math.degrees)
|
|
|
NameError: name 'heip' is not defined. Did you mean: 'help'?
|
|
|
help(math.degrees)
|
|
|
Help on built-in function degrees in module math:
|
|
|
|
|
|
degrees(x, /)
|
|
|
Convert angle x from radians to degrees.
|
|
|
|
|
|
math.degrees(180)
|
|
|
10313.240312354817
|
|
|
hep(math.exp)
|
|
|
Traceback (most recent call last):
|
|
|
File "<pyshell#33>", line 1, in <module>
|
|
|
hep(math.exp)
|
|
|
NameError: name 'hep' is not defined. Did you mean: 'hex'?
|
|
|
help(math.exp)
|
|
|
Help on built-in function exp in module math:
|
|
|
|
|
|
exp(x, /)
|
|
|
Return e raised to the power of x.
|
|
|
|
|
|
math.exp(2)
|
|
|
7.38905609893065
|
|
|
math.log(10)
|
|
|
2.302585092994046
|
|
|
math.log(8, 2)
|
|
|
3.0
|
|
|
math.log10(10)
|
|
|
1.0
|
|
|
math.sqrt(4)
|
|
|
2.0
|
|
|
math.ceil(2.3)
|
|
|
3
|
|
|
math.ceil(2.3)
|
|
|
3
|
|
|
math.floor(2.3)
|
|
|
2
|
|
|
math.floor(-2.3)
|
|
|
-3
|
|
|
math.ceil(-2.3)
|
|
|
-2
|
|
|
math.pi
|
|
|
3.141592653589793
|
|
|
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
|
|
|
dir(random)
|
|
|
Traceback (most recent call last):
|
|
|
File "<pyshell#50>", line 1, in <module>
|
|
|
dir(random)
|
|
|
NameError: name 'random' is not defined. Did you forget to import 'random'?
|
|
|
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()
|
|
|
random.seed(42)
|
|
|
random.random()
|
|
|
0.6394267984578837
|
|
|
random.uniform(5, 15)
|
|
|
5.25010755222667
|
|
|
random.randint(1, 100)
|
|
|
36
|
|
|
random.gauss(0, 1)
|
|
|
0.017593105583573694
|
|
|
a=[1,2,3,4,5,6,7]
|
|
|
random.choice(a)
|
|
|
1
|
|
|
random.shuffle(a)
|
|
|
a
|
|
|
[4, 2, 3, 1, 5, 7, 6]
|
|
|
random.sample(range(100), 5)
|
|
|
[4, 3, 11, 27, 29]
|
|
|
random.betavariate(2, 5)
|
|
|
0.3918844780644009
|
|
|
random.gammavariate(2, 1)
|
|
|
2.219353519271194
|
|
|
random_values = [
|
|
|
# 1. Равномерное распределение [0, 10)
|
|
|
random.uniform(0, 10),
|
|
|
|
|
|
# 2. Нормальное распределение (mu=50, sigma=10)
|
|
|
random.gauss(50, 10),
|
|
|
|
|
|
# 3. Бета-распределение (alpha=2, beta=5)
|
|
|
random.betavariate(2, 5),
|
|
|
|
|
|
# 4. Гамма-распределение (alpha=3, beta=2)
|
|
|
random.gammavariate(3, 2)
|
|
|
]
|
|
|
random_values
|
|
|
[5.892656838759088, 55.47961646339978, 0.5314696353281997, 2.163791803055314]
|
|
|
distributions = [
|
|
|
"Равномерное [0, 10)",
|
|
|
"Нормальное (μ=50, σ=10)",
|
|
|
"Бета (α=2, β=5)",
|
|
|
"Гамма (α=3, β=2)"
|
|
|
]
|
|
|
list(zip(random_values, distributions))
|
|
|
[(5.892656838759088, 'Равномерное [0, 10)'), (55.47961646339978, 'Нормальное (μ=50, σ=10)'), (0.5314696353281997, 'Бета (α=2, β=5)'), (2.163791803055314, 'Гамма (α=3, β=2)')]
|
|
|
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
|
|
|
1758211745.990668
|
|
|
c2=time.time()-c1
|
|
|
с2
|
|
|
Traceback (most recent call last):
|
|
|
File "<pyshell#76>", line 1, in <module>
|
|
|
с2
|
|
|
NameError: name 'с2' is not defined
|
|
|
>>> c2
|
|
|
87.25691390037537
|
|
|
>>> dat=time.gmtime()
|
|
|
>>> dat
|
|
|
time.struct_time(tm_year=2025, tm_mon=9, tm_mday=18, tm_hour=16, tm_min=12, tm_sec=46, tm_wday=3, tm_yday=261, tm_isdst=0)
|
|
|
>>> dat.tm_mon
|
|
|
9
|
|
|
>>> dat.tm_year
|
|
|
2025
|
|
|
>>> dat.tm_mday
|
|
|
18
|
|
|
>>> dat.tm_hour
|
|
|
16
|
|
|
>>> dat.tm_min
|
|
|
12
|
|
|
>>> dat.tm_sec
|
|
|
46
|
|
|
>>> dat.tm_wday
|
|
|
3
|
|
|
>>> dat.tm_yday
|
|
|
261
|
|
|
>>> dat.tm_isdst
|
|
|
0
|