Telegram Group & Telegram Channel
Что выведет следующий код на Python?


a = 256
b = 256
c = 257
d = 257

print(a is b) # #1
print(c is d) # #2

print(True + True + True == 3) # #3
print(True is 1) # #4
print(False == 0) # #5
print(False is 0) # #6


🔢 Варианты ответа:

A)

True
True
True
True
True


B)

False
True
False
True
False


C)

False
True
False
True
False


D)

True
False
False
False
False


Правильный ответ: B

💡 Почему?
-
a is bTrue, потому что int от -5 до 256 кэшируются.
-
c is dFalse, число 257 не кэшируется.
-
True + True + True == 3True, более того, True == 1.
-
True is 1False — это разные типы (bool и int).
-
False == 0True, False is 0False.



tg-me.com/pro_python_code/1788
Create:
Last Update:

Что выведет следующий код на Python?


a = 256
b = 256
c = 257
d = 257

print(a is b) # #1
print(c is d) # #2

print(True + True + True == 3) # #3
print(True is 1) # #4
print(False == 0) # #5
print(False is 0) # #6


🔢 Варианты ответа:

A)

True
True
True
True
True


B)

False
True
False
True
False


C)

False
True
False
True
False


D)

True
False
False
False
False


Правильный ответ: B

💡 Почему?
-
a is bTrue, потому что int от -5 до 256 кэшируются.
-
c is dFalse, число 257 не кэшируется.
-
True + True + True == 3True, более того, True == 1.
-
True is 1False — это разные типы (bool и int).
-
False == 0True, False is 0False.

BY Python RU


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/pro_python_code/1788

View MORE
Open in Telegram


Python RU Telegram | DID YOU KNOW?

Date: |

Traders also expressed uncertainty about the situation with China Evergrande, as the indebted property company has not provided clarification about a key interest payment.In economic news, the Commerce Department reported an unexpected increase in U.S. new home sales in August.Crude oil prices climbed Friday and front-month WTI oil futures contracts saw gains for a fifth straight week amid tighter supplies. West Texas Intermediate Crude oil futures for November rose $0.68 or 0.9 percent at 73.98 a barrel. WTI Crude futures gained 2.8 percent for the week.

The STAR Market, as is implied by the name, is heavily geared toward smaller innovative tech companies, in particular those engaged in strategically important fields, such as biopharmaceuticals, 5G technology, semiconductors, and new energy. The STAR Market currently has 340 listed securities. The STAR Market is seen as important for China’s high-tech and emerging industries, providing a space for smaller companies to raise capital in China. This is especially significant for technology companies that may be viewed with suspicion on overseas stock exchanges.

Python RU from ru


Telegram Python RU
FROM USA