Тема 3 <Анисенков Павел Дмитриевич>
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.
logiz1=bool(56)
logiz2=bool(0)
logiz3=bool("Beta")
logiz4=bool("")
logiz1
True
logiz2
False
logiz3
True
logiz4
False
tt1=int(198.6)
tt1
198
tt2=int("-76")
tt2
-76
tt3=int("B",16)
tt3
11
tt4=int("71",8)
tt4
57
tt5=int("98.76")
Traceback (most recent call last):
  File "<pyshell#16>", line 1, in <module>
    tt5=int("98.76")
ValueError: invalid literal for int() with base 10: '98.76'
\
 flt1=float(789)
SyntaxError: unexpected indent
flt1=float(789)
flt1
789.0
flt2=float(-6.78e2)
flt2
-678.0
flt22=float(98.76)
flt22
98.76
flt3=float("Infinity")
flt3
inf
flt4=float("-inf")
flt4
-inf
hh=123
dv1=bin(hh)
dv1
'0b1111011'
vos1=oct(hh)
vos1
'0o173'
shs1=hex(hh)
shs1
'0x7b'
int(dv1,2)
123
int(dv1,8)
Traceback (most recent call last):
  File "<pyshell#36>", line 1, in <module>
    int(dv1,8)
ValueError: invalid literal for int() with base 8: '0b1111011'
int(vos1,8)
123
int(shs1,16)
123
strk1=str(23.6)
strk1
'23.6'
strk2=str(logiz3)
strk2
'True'
strk3=str(["A","B","C"])
strk3
"['A', 'B', 'C']"
strk4=str(("A","B","C"))
strk4
"('A', 'B', 'C')"
strk5=str({"A":1,"B":2,"C":9})
strk5
"{'A': 1, 'B': 2, 'C': 9}"
spis1=list("Строка символов")
spis1
['С', 'т', 'р', 'о', 'к', 'а', ' ', 'с', 'и', 'м', 'в', 'о', 'л', 'о', 'в']
spis2=list((124,236,-15,908))
spis2
[124, 236, -15, 908]
spis3=list({"A":1,"B":2,"C":9})
spis3
['A', 'B', 'C']
spis3 = list({"A":1,"B":2,"C":9}.values())
spis3
[1, 2, 9]
spis3 = list({"A":1,"B":2,"C":9}.items())
spis3
[('A', 1), ('B', 2), ('C', 9)]
kort7=tuple('Строка символов')
kort7
('С', 'т', 'р', 'о', 'к', 'а', ' ', 'с', 'и', 'м', 'в', 'о', 'л', 'о', 'в')
 kort8=tuple(spis2)
 
SyntaxError: unexpected indent
kort8=tuple(spis2)
kort8
(124, 236, -15, 908)
kort9=tuple({"A":1,"B":2,"C":9})
kort9
('A', 'B', 'C')
del strk5, kort8
strk5
Traceback (most recent call last):
  File "<pyshell#67>", line 1, in <module>
    strk5
NameError: name 'strk5' is not defined. Did you mean: 'strk1'?
kort8
Traceback (most recent call last):
  File "<pyshell#68>", line 1, in <module>
    kort8
NameError: name 'kort8' is not defined. Did you mean: 'kort7'?
name= "Анисенков П. Д."
namelist = list(name)
namelist
['А', 'н', 'и', 'с', 'е', 'н', 'к', 'о', 'в', ' ', 'П', '.', ' ', 'Д', '.']
nametup = tuple(namelist)
nametup
('А', 'н', 'и', 'с', 'е', 'н', 'к', 'о', 'в', ' ', 'П', '.', ' ', 'Д', '.')
namestr = str(nametup)
namestr
"('А', 'н', 'и', 'с', 'е', 'н', 'к', 'о', 'в', ' ', 'П', '.', ' ', 'Д', '.')"
12+7+90
109
5.689e-1 - 0.456
0.11289999999999994
23.6+54
77.6
14-56.7+89
46.3
-6.7*12
-80.4
-234.5/6
-39.083333333333336
 a=178/45
 
SyntaxError: unexpected indent
a=178/45
a
3.9555555555555557
type(a)
<class 'float'>
b=178//45
b
3
c=-24.6//12.1
c
-3.0
d=-18//4.76468
d
-4.0
KeyboardInterrupt
148%33
16
12.6%3.8
1.2000000000000002
18%4.45656
0.17376000000000147
-18%4.45656
4.282799999999998
14**3
2744
e=2.7**3.6
e
35.719843790663525
g=52**22.8
g
1.333141459723109e+39
z1 = 3 + 4j, z2 = 1 - 2j
SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='?
z1=3+4j
z2=1-2j
z1+z2
(4+2j)
z1-z2
(2+6j)
z1*z2
(11-2j)
z1/z2
(-1+2j)
z1**2
(-7+24j)
z1//z2
Traceback (most recent call last):
  File "<pyshell#109>", line 1, in <module>
    z1//z2
TypeError: unsupported operand type(s) for //: 'complex' and 'complex'
z1%z2
Traceback (most recent call last):
  File "<pyshell#110>", line 1, in <module>
    z1%z2
TypeError: unsupported operand type(s) for %: 'complex' and 'complex'
dv1=9
dv2=~dv1
dv2
-10
dv1
9
7&9
1
7&8
0
7|9
15
7|8
15
14|5
15
14:5
SyntaxError: illegal target for annotation
14^5
11
h=14
g=h<<2
g
56
g1=h>>1
g1
7
g2=h>>2
g2
3
a = 0b10110101
b = 0b01101011
a&b
33
a|b
255
a^b
222
a<<2
724
b<<3
856
'Система '+'регулирования'
'Система регулирования'
['abc','de','fg']+['hi','jkl']
['abc', 'de', 'fg', 'hi', 'jkl']
('abc','de','fg')+('hi','jkl')
('abc', 'de', 'fg', 'hi', 'jkl')
'ля-'*5
'ля-ля-ля-ля-ля-'
['ку','-']*3
['ку', '-', 'ку', '-', 'ку', '-']
('кис','-')*4
('кис', '-', 'кис', '-', 'кис', '-', 'кис', '-')
signal1=[0]*3+[1]*99
signal1
[0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
stroka='Система автоматического управления'
stroka
'Система автоматического управления'
'автомат' in stroka
True
'ку' in ['ку','-']*3
True
'ля-' in ('abc', 'de', 'fg', 'hi', 'jkl')
False
stroka='Температура = %g %s  %g'
stroka
'Температура = %g %s  %g'
stroka % (16,' меньше ',25)
'Температура = 16  меньше   25'
KeyboardInterrupt
stroka='Температура = %(zn1)g %(sravn)s  %(zn2)g'
stroka
'Температура = %(zn1)g %(sravn)s  %(zn2)g'
stroka % {'zn1':16,'sravn':' меньше ','zn2':25}
'Температура = 16  меньше   25'
zz=-12
zz
-12
zz+=5
zz
-7
zz-=3
zz
-10
stroka='Система'
stroka+=' регулирования'
stroka
'Система регулирования'
zz/=2
zz
-5.0
zz*=5
zz
-25.0
dd=56.8
dd//=
SyntaxError: invalid syntax
dd//=2
dd
28.0
dd%=3
dd
1.0
dd+=4
dd
5.0
dd**=2
dd
25.0
w=v=10
n1,n2,n3=(11,-3,'all')
n1
11
n3
'all'
n1, n2, n3 = "11-"
n1
'1'
n3
'-'
n1, n2, n3 = [11, -3, 'all']
n1
11
n3
'all'
python
n1, n2, n3 = {11, -3, 'all'}
SyntaxError: multiple statements found while compiling a single statement
n1, n2, n3 = {11, -3, 'all'}
n1
-3
n2
11
n3
'all'
n1, n2, n3 = {'a': 11, 'b': -3, 'c': 'all'}
т1
Traceback (most recent call last):
  File "<pyshell#194>", line 1, in <module>
    т1
NameError: name 'т1' is not defined
n`
SyntaxError: invalid syntax
n1
'a'
n2
'b'
w==v
True
w!=v
False
w<v
False
w>w
False
w>v
False
w<=v
True
w>=v
True
mnoz1={'pen','book','pen','iPhone','table','book'}
'book' in mnoz1
True
'cap' in mnoz1
False
dic1={'Saratov':145, 'Orel':56, 'Vologda':45}
'Vologda' in dic1
True
'Pskov' in dic1
False

56 in dic1.values()
True
dct1={'Institut':['AVTI','IEE','IBB'],'Depart':['UII','PM','VMSS','MM'],'gruppa': ['A-01-15','A-02-15']}
'UII' in dct1['Depart']
True
dct1['Depart'][1] == 'MM'
False
a=17
b=
SyntaxError: invalid syntax
b=6
(a>=b) and ('book' in mnoz1) and not ('Pskov' in dic1)
True
age = 25
has_subscription = True
blacklist = {'spam@mail.com', 'fake@mail.com'}
user_email = "user@example.com"
access = (age >= 18) and has_subscription and (user_email not in blacklist)
access
True
w=v=10
w is v
True
w1=['A','B']
v1=['A','B']
w1 is v1
False
stroka.find('пр')
-1
stroka.count("с")
1
stroka.replace(' у',' автоматического у')
'Система регулирования'
stroka
'Система регулирования'
KeyboardInterrupt
spis22=stroka.split(' ')
spis22
['Система', 'регулирования']
stroka.upper()
'СИСТЕМА РЕГУЛИРОВАНИЯ'
stroka3=" ".join(spis22)
stroka3
'Система регулирования'
stroka3.partition("с")
('Си', 'с', 'тема регулирования')
stroka3.rpartition("с")
('Си', 'с', 'тема регулирования')
strk1='Момент времени {}, значение = {}'
strk1
'Момент времени {}, значение = {}'
strk1.format(1,89.7

             )
'Момент времени 1, значение = 89.7'
strk2='Момент времени {1}, значение = {0}:{2}'
strk2
'Момент времени {1}, значение = {0}:{2}'
strk2.format(36.7,2,'норма!')
'Момент времени 2, значение = 36.7:норма!'
strk3='Момент времени {num}, значение = {znch}'
strk3
'Момент времени {num}, значение = {znch}'
strk3.format(znch=89.7,num=2)
'Момент времени 2, значение = 89.7'
strk3
'Момент времени {num}, значение = {znch}'
spsk = [10, 'hello', 3.14, True, 'world', 10, 'python']
spsk.pop(2)
3.14
spsk.append('c')
spsk
[10, 'hello', True, 'world', 10, 'python', 'c']
spsk.insert(2,'a')
spsk
[10, 'hello', 'a', True, 'world', 10, 'python', 'c']
spsk.count('a')
1
spsk.pop(1)
'hello'
spsk
[10, 'a', True, 'world', 10, 'python', 'c']
my_tuple = (1, 2, 3, 2, 'a', 'b', 'a', True)
my_tuple.count(2)
2
my_tuple.insert(2,'a')
Traceback (most recent call last):
  File "<pyshell#265>", line 1, in <module>
    my_tuple.insert(2,'a')
AttributeError: 'tuple' object has no attribute 'insert'
my_tuple.append('c')
Traceback (most recent call last):
  File "<pyshell#266>", line 1, in <module>
    my_tuple.append('c')
AttributeError: 'tuple' object has no attribute 'append'
my_tuple.append('c')
Traceback (most recent call last):
  File "<pyshell#267>", line 1, in <module>
    my_tuple.append('c')
AttributeError: 'tuple' object has no attribute 'append'

my_dict = {'name': 'Alice', 'age': 25, 'city': 'Moscow', 'age': 26}
my_dict.count(2)
Traceback (most recent call last):
  File "<pyshell#270>", line 1, in <module>
    my_dict.count(2)
AttributeError: 'dict' object has no attribute 'count'
my_dict.pop(2)
Traceback (most recent call last):
  File "<pyshell#271>", line 1, in <module>
    my_dict.pop(2)
KeyError: 2
my_dict.pop(25)
Traceback (most recent call last):
  File "<pyshell#272>", line 1, in <module>
    my_dict.pop(25)
KeyError: 25
my_dict.pop(0)
Traceback (most recent call last):
  File "<pyshell#273>", line 1, in <module>
    my_dict.pop(0)
KeyError: 0
my_dict.count(2)
Traceback (most recent call last):
  File "<pyshell#274>", line 1, in <module>
    my_dict.count(2)
AttributeError: 'dict' object has no attribute 'count'
"keys():", list(my_dict.keys())
('keys():', ['name', 'age', 'city'])
"values():", list(my_dict.values())
('values():', ['Alice', 26, 'Moscow'])
"pop('city'):", my_dict.pop('city')
("pop('city'):", 'Moscow')
my_dict
{'name': 'Alice', 'age': 26}
set1 = {1, 2, 3, 4, 5}
set2 = {4, 5, 6, 7, 8}
"add(9):", set1.add(9)
('add(9):', None)
set1
{1, 2, 3, 4, 5, 9}
set2.remove(3)
Traceback (most recent call last):
  File "<pyshell#283>", line 1, in <module>
    set2.remove(3)
KeyError: 3
set1.remove(3)
set1
{1, 2, 4, 5, 9}
