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: |

How to Create a Private or Public Channel on Telegram? During the meeting with TSE Minister Edson Fachin, Perekopsky also mentioned the TSE channel on the platform as one of the firm's key success stories. Launched as part of the company's commitments to tackle the spread of fake news in Brazil, the verified channel has attracted more than 184,000 members in less than a month. The SUCK Channel on Telegram, with a message saying some content has been removed by the police. Photo: Telegram screenshot. A Telegram channel is used for various purposes, from sharing helpful content to implementing a business strategy. In addition, you can use your channel to build and improve your company image, boost your sales, make profits, enhance customer loyalty, and more. Telegram message that reads: "Bear Market Screaming Therapy Group. You are only allowed to send screaming voice notes. Everything else = BAN. Text pics, videos, stickers, gif = BAN. Anything other than screaming = BAN. You think you are smart = BAN.
from us


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