SpecialistOff.NET / Вопросы / Статьи / Фрагменты кода / Резюме / Метки / Помощь / Файлы

Список вопросов Печать

Почему возникает особенность сравнения в Python?


Метки: python 

>>> a: int = 100
>>> b: int = 200
>>> bin(a)
'0b1100100'
>>> bin(b)
'0b11001000'
>>> a & b  
64 >>> a and b 200 >>> b and a 100

Ответы

RemiZOffAlex  Создано: 2020-06-29 22:31:31.804670  Обновлено: 2020-06-29 22:31:31.804670

The expression x and y first evaluates x; if x is false, its value is returned; otherwise, y is evaluated and the resulting value is returned.

The expression x or y first evaluates x; if x is true, its value is returned; otherwise, y is evaluated and the resulting value is returned.

Ссылки

Возможно будут интересны и другие вопросы