Python 3.11.5 (tags/v3.11.5:cce6ba9, Aug 24 2023, 14:38:34) [MSC v.1936 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license()" for more information. logiz=bool(56) logiz1=bool(56) logiz1 True logiz2=bool(0) logiz2 False logiz3=bool("beta") logiz3 True logiz4=bool("") 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 "", line 1, in tt5=int("98.76") ValueError: invalid literal for int() with base 10: '98.76' flt1=float(789) flt1 789.0 flt2=float(-6,78e2) Traceback (most recent call last): File "", line 1, in flt2=float(-6,78e2) TypeError: float expected at most 1 argument, got 2 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' sch1=hex(hh) sch1 '0x7b' '0x7b' '0x7b' hh1=int(dv1,2) hh1 123 hh2=int(vos1,8) hh2 123 hh3=int(sch1,16) hh3 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'] spis4=list({"A":2,"B":1,"C":9}) spis4 ['A', 'B', 'C'] 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 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'? name1=str(Румянцев В А) SyntaxError: invalid syntax. Perhaps you forgot a comma? name1=str('Румянцев В А') name1 'Румянцев В А' name2=list(name1) name2 ['Р', 'у', 'м', 'я', 'н', 'ц', 'е', 'в', ' ', 'В', ' ', 'А'] name3=tuple(name2) name3 ('Р', 'у', 'м', 'я', 'н', 'ц', 'е', 'в', ' ', 'В', ' ', 'А') name4=str(name4) Traceback (most recent call last): File "", line 1, in name4=str(name4) NameError: name 'name4' is not defined. Did you mean: 'name1'? name4=str(name3) name4 "('Р', 'у', 'м', 'я', 'н', 'ц', 'е', 'в', ' ', 'В', ' ', 'А')" 12+7+90 109 5.689e-1-0,456 (0.5689, 456) 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 3 c=-24.6//12.1 c -3.0 d=5.689e-1 // 2 d 0.0 5.689e-1 // 0.456 1.0 148%33 16 12.6%3.8 1.2000000000000002 5.689e-1 % 0.456 0.11289999999999994 14**3 2744 e=2.7**3.6 у Traceback (most recent call last): File "", line 1, in у NameError: name 'у' is not defined e 35.719843790663525 5.689e-1 ** 0.456 0.7732080836573664 dv1=9 dv1 9 dv2=~dv1 dv2 -10 7&9 1 7&8 0 bin(7&9) '0b1' bin(7&8) '0b0' bin(7|9) '0b1111' bin(7|8) '0b1111' bin(14|5) '0b1111' bin(14^5) '0b1011' h=14 g=h<<2 g 56 g1=h>>1 h1=bin(h) h1 '0b1110' g=bin(h1<<2) Traceback (most recent call last): File "", line 1, in g=bin(h1<<2) TypeError: unsupported operand type(s) for <<: 'str' and 'int' g=(h1<<2) Traceback (most recent call last): File "", line 1, in g=(h1<<2) TypeError: unsupported operand type(s) for <<: 'str' and 'int' g=bin(h<<2 ) g '0b111000' g1=h>>1 g1 7 g1=bin(h>>1) g1 '0b111' g2=bin(h>>2) g2 '0b11' h7=1341 h71=bin(h7) h71 '0b10100111101' g7=bin(h7<<4) g7 '0b101001111010000' g71=bin(h7>>5) g71 '0b101001' 'Система '+'регулирования' 'Система регулирования' ['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] signal2=(0,)*3+(1,)*5+(0,)*7 signal2 (0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0) 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' 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+=5 zz -7 zz-=3 zz -10 stroka='Система' stroka 'Система' stroka+=' регулирования' stroka 'Система регулирования' zz/=2 zz -5.0 zz*=5 zz -25.0 zz//=4 zz -7.0 zz%=2 zz 1.0 zz+=8 zz 9.0 zz**=3 zz 729.0 w=v=10 w 10 v 10 n1,n2,n3=(11,-3,'all') n1 11 n2 -3 n3 'all' w==v True w!=v False wv False w<=v True w>=v True mnoz1={'pen','book','pen','iPhone','table','book'} mnoz1 {'pen', 'table', 'iPhone', 'book'} 'book' in mnoz1 True 'cap' in mnoz1 False dic1={'Saratov':145, 'Orel':56, 'Vologda':45} 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']} 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=-6 (a>=b) and ('book' in mnoz1) and not ('Pskov' in dic1) True (a==b) and ('Pskov' in dic1) or not ('cap' in mnoz1) True w=v=10 w is v True w1=['A','B'] v1=['A','B'] w1 ['A', 'B'] v1 ['A', 'B'] w1 is v1 False stroka='Микропроцессорная система управления' dir(stroka) ['__add__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'capitalize', 'casefold', 'center', 'count', 'encode', 'endswith', 'expandtabs', 'find', 'format', 'format_map', 'index', 'isalnum', 'isalpha', 'isascii', 'isdecimal', 'isdigit', 'isidentifier', 'islower', 'isnumeric', 'isprintable', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'maketrans', 'partition', 'removeprefix', 'removesuffix', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill'] stroka.find('пр') 5 stroka.count("с") 4 stroka.replace(' у',' автоматического у') 'Микропроцессорная система автоматического управления' 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}' SyntaxError: unexpected indent strk2='Момент времени {1}, значение = {0}:{2}' strk2.format(36.7,2,'норма!') 'Момент времени 2, значение = 36.7:норма!' strk3='Момент времени {num}, значение = {znch}' strk3.format(znch=89.7,num=2) 'Момент времени 2, значение = 89.7' spsk.pop(2) Traceback (most recent call last): File "", line 1, in spsk.pop(2) NameError: name 'spsk' is not defined. Did you mean: 'spis1'? spsk=list('jifoesd') spsk ['j', 'i', 'f', 'o', 'e', 's', 'd'] spsk.pop(2) 'f' spsk.append('c') spsk ['j', 'i', 'o', 'e', 's', 'd', 'c'] spsk.insert(2,'a') spsk ['j', 'i', 'a', 'o', 'e', 's', 'd', 'c'] spsk.count('a') 1 kort=tuple('jhbdfja') kort ('j', 'h', 'b', 'd', 'f', 'j', 'a') kort.pop(2) Traceback (most recent call last): File "", line 1, in kort.pop(2) AttributeError: 'tuple' object has no attribute 'pop' numbers = (1, 2, 3, 2, 4, 2, 5, 2) count_2 = numbers.count(2) count_2 4 index_3 = numbers.index('3') Traceback (most recent call last): File "", line 1, in index_3 = numbers.index('3') ValueError: tuple.index(x): x not in tuple person = {"name": "Alice", "age": 25} print("Исходный словарь:", person) # Обновление другим словарем person.update({"age": 26, "city": "Moscow"}) print("После update:", person) # Обновление итерируемым объектом person.update([("country", "Russia"), ("language", "Russian")]) ... print("После update списком:", person) SyntaxError: multiple statements found while compiling a single statement >>> >>> person = {"name": "Alice", "age": 25, "city": "Moscow", "country": "Russia"} >>> age = person.pop("age") >>> age 25 >>> person = {"name": "Alice", "age": 25, "city": "Moscow"} >>> last_item = person.popitem() >>> last_item ('city', 'Moscow') >>> >>> >>> fruits = {"apple", "banana", "orange"} >>> fruits.add("grape") >>> fruits {'grape', 'orange', 'apple', 'banana'} >>> >>> numbers = {1, 2, 3, 4, 5} >>> numbers.remove(3) >>> numbers {1, 2, 4, 5} >>> >>> numbers = {1, 2, 3, 4, 5} >>> numbers.clear() >>> numbers set()