PYTHON_WITH_MOHAMMAD Telegram 75
تفاوت `is` و `==` در پایتون!


🔹 در پایتون، == مقدار دو متغیر را مقایسه می‌کند، اما is بررسی می‌کند که آیا دو متغیر به یک شیء یکسان در حافظه اشاره دارند یا نه!

a = [1, 2, 3]
b = [1, 2, 3]

print(a == b) # خروجی: True
print(a is b) # خروجی: False

🔸 چرا؟ چون a و b مقدار یکسانی دارند اما دو لیست جداگانه در حافظه‌اند!



tgoop.com/python_with_mohammad/75
Create:
Last Update:

تفاوت `is` و `==` در پایتون!


🔹 در پایتون، == مقدار دو متغیر را مقایسه می‌کند، اما is بررسی می‌کند که آیا دو متغیر به یک شیء یکسان در حافظه اشاره دارند یا نه!

a = [1, 2, 3]
b = [1, 2, 3]

print(a == b) # خروجی: True
print(a is b) # خروجی: False

🔸 چرا؟ چون a و b مقدار یکسانی دارند اما دو لیست جداگانه در حافظه‌اند!

BY آموزش پایتون و برنامه نویسی


Share with your friend now:
tgoop.com/python_with_mohammad/75

View MORE
Open in Telegram


Telegram News

Date: |

Ng was convicted in April for conspiracy to incite a riot, public nuisance, arson, criminal damage, manufacturing of explosives, administering poison and wounding with intent to do grievous bodily harm between October 2019 and June 2020. Among the requests, the Brazilian electoral Court wanted to know if they could obtain data on the origins of malicious content posted on the platform. According to the TSE, this would enable the authorities to track false content and identify the user responsible for publishing it in the first place. A new window will come up. Enter your channel name and bio. (See the character limits above.) Click “Create.” To upload a logo, click the Menu icon and select “Manage Channel.” In a new window, hit the Camera icon. As of Thursday, the SUCK Channel had 34,146 subscribers, with only one message dated August 28, 2020. It was an announcement stating that police had removed all posts on the channel because its content “contravenes the laws of Hong Kong.”
from us


Telegram آموزش پایتون و برنامه نویسی
FROM American