Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

94 строки
3.2 KiB
Plaintext

#Тема 4 <Анисенков Павел Дмитриевич>
Python 3.13.6 (tags/v3.13.6:4e66535, Aug 6 2025, 14:36:00) [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.
round(123.456,1)
123.5
round(123.456,0)
123.0
type(round(123.456,0))
<class 'float'>
type(round(123.456,1\))
SyntaxError: unexpected character after line continuation character
type(round(123.456,1))
<class 'float'>
type(round(123.456,))
<class 'int'>
len(123)
Traceback (most recent call last):
File "<pyshell#7>", line 1, in <module>
len(123)
TypeError: object of type 'int' has no len()
len('hello')
5
import pylab
imp
ort sys
SyntaxError: invalid syntax
import sys
x=list(range(-3,55,4))
=list(range(15))
SyntaxError: invalid syntax
t=list(range(15))
pylab.plot(t,x)
[<matplotlib.lines.Line2D object at 0x000002A6746F8F50>]
pylab.title('Первый график')
Text(0.5, 1.0, 'Первый график')
pylab.xlabel('время')
SyntaxError: unexpected indent
pylab.xlabel('время')
Text(0.5, 0, 'время')
pylab.ylabel('сигнал')
Text(0, 0.5, 'сигнал')
pylab.show() #Отображение графика на экране
ывав
X1=[12,6,8,10,7]
X2=[5,7,9,11,13]
pylab.plot(X1)
[<matplotlib.lines.Line2D object at 0x000002A675E05950>]
pylab.plot(X2)
[<matplotlib.lines.Line2D object at 0x000002A675E05A90>]
pylab.show()
region=['Центр','Урал','Сибирь','Юг']
naselen=[65,12,23,17]
pylab.pie(naselen,labels=region)
([<matplotlib.patches.Wedge object at 0x000002A6745F7CB0>, <matplotlib.patches.Wedge object at 0x000002A675783750>, <matplotlib.patches.Wedge object at 0x000002A675783B10>, <matplotlib.patches.Wedge object at 0x000002A675783D90>], [Text(-0.191013134139045, 1.0832885038559115, 'Центр'), Text(-0.861328292412156, -0.6841882582231001, 'Урал'), Text(0.04429273995539947, -1.0991078896938387, 'Сибирь'), Text(0.9873750693480946, -0.48486129194837324, 'Юг')])
pylab.show() #Отображение диаграммы
data = [1, 2, 3, 3, 2, 3, 3, 3, 2]
pylab.hist(data, bins=3)
(array([1., 3., 5.]), array([1. , 1.66666667, 2.33333333, 3. ]), <BarContainer object of 3 artists>)
SyntaxError: multiple statements found while compiling a single statement
pylab.hist(data, bins=3)
(array([1., 3., 5.]), array([1. , 1.66666667, 2.33333333, 3. ]), <BarContainer object of 3 artists>)
pylab.title("Гистограмма")
Text(0.5, 1.0, 'Гистограмма')
Text(0.5, 1.0, 'Гистограмма')
Traceback (most recent call last):
File "<pyshell#34>", line 1, in <module>
Text(0.5, 1.0, 'Гистограмма')
NameError: name 'Text' is not defined. Did you mean: 'next'?
pylab.show()
c = ['A', 'B', 'C', 'D']
v = [25, 40, 30, 50]
pylab.bar(c, v)
<BarContainer object of 4 artists>
pylab.title("Столбиковая диаграмма")
Text(0.5, 1.0, 'Столбиковая диаграмма')
pylab.show()