diff --git a/TEMA3/protocol.py b/TEMA3/protocol.py new file mode 100644 index 0000000..1bb598c --- /dev/null +++ b/TEMA3/protocol.py @@ -0,0 +1,546 @@ +'Тема 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. +import os +os.chdir('C:\\Users\\Ekaterina\\OneDrive\\Desktop\\Solovyova\\python-labs\\TEMA3') +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' +SyntaxError: unterminated string literal (detected at line 1) +tt2 +-76 +tt2=int("-76") +tt4=int("71",8) +type(tt2) + +tt3=int("B",16) +tt3 +11 +tt4=int("71",8) +tt4 +57 +tt5=int("98.76") +Traceback (most recent call last): + File "", line 1, in + tt5=int("98.76") +ValueError: invalid literal for int() with base 10: '98.76' +tt4 = int(71, 8) +Traceback (most recent call last): + File "", line 1, in + tt4 = int(71, 8) +TypeError: int() can't convert non-string with explicit base +a=int(2) +a +2 +flt1=float(789) +flt1 +789.0 +flt2=float(-6.78e2) +flt2 +-678.0 +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' +dv1=int(dv1,2) +dv1 +123 +vos1=int(vos1,8) +vos1=int(vos1,8) +Traceback (most recent call last): + File "", line 1, in + vos1=int(vos1,8) +TypeError: int() can't convert non-string with explicit base +vos1 +123 +shs1=int(shs1,16) +shs1 +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}" +print(strk1) +23.6 +print(strk2) +True +print(strk3) +['A', 'B', 'C'] +print(strk4) +('A', 'B', 'C') +print(strk5) +{'A': 1, 'B': 2, 'C': 9} +type(strk5) + +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)] +spis3 = [value for value in {"A":1,"B":2,"C":9}.values() if value % 2 == 0] +spis3 +[2] +print(spis1) +['С', 'т', 'р', 'о', 'к', 'а', ' ', 'с', 'и', 'м', 'в', 'о', 'л', 'о', 'в'] + kort7=tuple('Строка символов') + +SyntaxError: unexpected indent +kort7=tuple('Строка символов') +kort7 +('С', 'т', 'р', 'о', 'к', 'а', ' ', 'с', 'и', 'м', 'в', 'о', 'л', 'о', 'в') +kort8=tuple(spis2) +kort8 +(124, 236, -15, 908) +kort9=tuple({"A":1,"B":2,"C":9}) +kort9 +('A', 'B', 'C') +del strk5, kort8 +fio='Solovyova E D' +spis0=list(fio) +spis0 +['S', 'o', 'l', 'o', 'v', 'y', 'o', 'v', 'a', ' ', 'E', ' ', 'D'] +kort0=tuple(fio) +kort0 +('S', 'o', 'l', 'o', 'v', 'y', 'o', 'v', 'a', ' ', 'E', ' ', 'D') +strk0=str(kort0) +kort0=tuple(spis0) +kort0 +('S', 'o', 'l', 'o', 'v', 'y', 'o', 'v', 'a', ' ', 'E', ' ', 'D') +strk0=str(kort0) +strk0 +"('S', 'o', 'l', 'o', 'v', 'y', 'o', 'v', 'a', ' ', 'E', ' ', 'D')" + strk5 + +SyntaxError: unexpected indent +strk5 +Traceback (most recent call last): + File "", line 1, in + strk5 +NameError: name 'strk5' is not defined. Did you mean: 'strk1'? +kort8 +Traceback (most recent call last): + File "", line 1, in + kort8 +NameError: name 'kort8' is not defined. Did you mean: 'kort7'? +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 +type(a) + +a +3.9555555555555557 +b=178//45,b +Traceback (most recent call last): + File "", line 1, in + b=178//45,b +NameError: name 'b' is not defined +b=178//45 +b +3 +type(b) + +c=-24.6//12.1 +c +-3.0 +tipe(c) +Traceback (most recent call last): + File "", line 1, in + tipe(c) +NameError: name 'tipe' is not defined. Did you mean: 'type'? +type(c) + +d = 56 // 6.01 +d +9.0 +print(d) +9.0 +type(d) + +e = 7.54// 2 +у +Traceback (most recent call last): + File "", line 1, in + у +NameError: name 'у' is not defined +e +3.0 +type(e) + +f = -15 // 4 +а +Traceback (most recent call last): + File "", line 1, in + а +NameError: name 'а' is not defined +а +Traceback (most recent call last): + File "", line 1, in + а +NameError: name 'а' is not defined +f +-4 +type(f) + +148%33 +16 +12.6%3.8 +1.2000000000000002 +20 % 3.5 +2.5 +-17 % 5 +3 +15.7 % 4 +3.6999999999999993 +14**3 +2744 + e=2.7**3.6 + +SyntaxError: unexpected indent +e=2.7**3.6 +14**3.6 +13367.830445904418 +2.7**3 +19.683000000000003 +z = complex(6, -8) +z**2 +(-28-96j) +2**z +(47.34786346201795+43.06018840625417j) +dv1=9 +dv1 +9 +dv2=~dv1 +dv2 +-10 +7&9 +1 +7&8 +0 +7|9 +15 +7|8 +15 +14|5 +15 +14^5 +11 +h=14 +g=h<<2 +g +56 +g1=h>>1 +g1 +7 +g2=h>>2 +g2 +3 +bin(245) +'0b11110101' +k=245 +k<<2 +980 +m=k<<2 +m +980 +k>>3 +30 +bin(456) +'0b111001000' +t=456 +t>>5 +14 +t<<14 +7471104 +'Система '+'регулирования' +'Система регулирования' +'ля-'*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] +signal2=(0,)*3+(1,)*5+(0,)*7 +signal2 +(0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0) +stroka='Система автоматического управления' +'автомат' in stroka +True +'ку' in ['ку','-']*3 +True +'ля-' in ('abc', 'de', 'fg', 'hi', 'jkl') +False +stroka='Температура = %g %s %g' +print(stroka) +Температура = %g %s %g +stroka % (16,' меньше ',25) +'Температура = 16 меньше 25' +stroka='Система' +stroka+=' регулирования' +z +(6-8j) +z=10 +zz +Traceback (most recent call last): + File "", line 1, in + zz +NameError: name 'zz' is not defined. Did you mean: 'z'? +zz=10 +zz/=2 +zz +5.0 +zz*=5 +zz +25.0 +n1,n2,n3=(11,-3,'all') +т3 +Traceback (most recent call last): + File "", line 1, in + т3 +NameError: name 'т3' is not defined +n3 +'all' +161=/10 +SyntaxError: cannot assign to literal +x=161 +x=/10 +SyntaxError: invalid syntax +161//=10 +SyntaxError: 'literal' is an illegal expression for augmented assignment +x//=10 +x +16 +x=166 +x\\=10 +SyntaxError: unexpected character after line continuation character +x//=10 +x +16 +x%=2 +x +0 +x=167 +x=2 +x**=4 +x +16 +n1,n2,n3=[11,-3,'all'] +n1,n2,n3='11,-3,'all'' +SyntaxError: invalid syntax +n1,n2,n3='11,-3,'a" +SyntaxError: unterminated string literal (detected at line 1) +n1,n2,n3='11,-3,'a' ' +SyntaxError: invalid syntax +n1,n2,n3="11,-3,'all' " +Traceback (most recent call last): + File "", line 1, in + n1,n2,n3="11,-3,'all' " +ValueError: too many values to unpack (expected 3) +n1, n2, n3 = "11,-3,'a'" +Traceback (most recent call last): + File "", line 1, in + n1, n2, n3 = "11,-3,'a'" +ValueError: too many values to unpack (expected 3) +n1, n2, n3 = "11", "-3", "all" +n1, n2, n3 = {11, -3, 'all'} +print(n1, n2, n3) +11 -3 all +print(n1, n2, n3) +11 -3 all +n1, n2, n3 = {'a': 1, 'b': 2, 'c': 3} +print(n1, n2, n3) +a b c +w +Traceback (most recent call last): + File "", line 1, in + w +NameError: name 'w' is not defined +v +Traceback (most recent call last): + File "", line 1, in + v +NameError: name 'v' is not defined +w=10 +v=20 +w==v +False +w!=v +True +wv +False +w<=v +True +w=>v +SyntaxError: invalid syntax +w>=v +False +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 + +SyntaxError: unexpected indent +a=17 +b=-6 +(a>=b) and ('book' in mnoz1) and not ('Pskov' in dic1 + + ) +True +x = 10 +y = 5 +name = "Anna" +result1 = (x > y) and (len(name) == 4) and not (y < 0) +print(result1) +True +(x > y) and (len(name) == 4) and not (y < 0) +True +price=3000 +color=blue +Traceback (most recent call last): + File "", line 1, in + color=blue +NameError: name 'blue' is not defined +color='blue' +price1=4000 +(price", line 1, in + spsk.pop(2) +IndexError: pop index out of range +spsk=['a','b','c','d','e','f'] +spsk.pop(2) +'c' +spsk +['a', 'b', 'd', 'e', 'f'] +spsk.append('c') +spsk +['a', 'b', 'd', 'e', 'f', 'c'] +spsk.insert(2,'a') +spsk +['a', 'b', 'a', 'd', 'e', 'f', 'c'] +spsk.count('a') +2 +