پاسخ صحیح؟!🔥 👇🏽
Correct answer?!
#️⃣ #چالش_پایتون #منطق_برنامه_نویسی #پایتون #کدنویسی #پای_ویژن
#PythonChallenge #ProgrammingLogic #Python #Coding #PyVision
🌐 @PyVision
Correct answer?!
#️⃣ #چالش_پایتون #منطق_برنامه_نویسی #پایتون #کدنویسی #پای_ویژن
#PythonChallenge #ProgrammingLogic #Python #Coding #PyVision
🌐 @PyVision
🤔2
PyVision | پایویژن
پاسخ صحیح؟!🔥 👇🏽 Correct answer?! #️⃣ #چالش_پایتون #منطق_برنامه_نویسی #پایتون #کدنویسی #پای_ویژن #PythonChallenge #ProgrammingLogic #Python #Coding #PyVision 🌐 @PyVision
✨️ خروجی False است! 🐍
چرا که عملگرها طبق ترتیب
not → and → or
ارزیابی میشوند.✅️
The output is False ✅️
because Python evaluates logical operators in this order:
not → and → or
#️⃣ #پایتون #کدنویسی #چالش_پایتون #پای_ویژن
#Python #PythonChallenge #LogicOperators #PyVision
🌐 @PyVision
چرا که عملگرها طبق ترتیب
not → and → or
ارزیابی میشوند.✅️
The output is False ✅️
because Python evaluates logical operators in this order:
not → and → or
#️⃣ #پایتون #کدنویسی #چالش_پایتون #پای_ویژن
#Python #PythonChallenge #LogicOperators #PyVision
🌐 @PyVision
🔥2🤩1
پاسخ صحیح؟!🔥 👇🏽
Correct answer?!
#️⃣ #پایتون #کدنویسی #چالش_پایتون #برنامهنویسی #آموزش_پایتون #منطق_پایتون #پای_ویژن
#Python #PythonChallenge #Coding #LearnPython #Programming #LogicOperators #PythonTips #PyVision
🌐 @PyVision
Correct answer?!
#️⃣ #پایتون #کدنویسی #چالش_پایتون #برنامهنویسی #آموزش_پایتون #منطق_پایتون #پای_ویژن
#Python #PythonChallenge #Coding #LearnPython #Programming #LogicOperators #PythonTips #PyVision
🌐 @PyVision
🔥1🤩1
PyVision | پایویژن
پاسخ صحیح؟!🔥 👇🏽 Correct answer?! #️⃣ #پایتون #کدنویسی #چالش_پایتون #برنامهنویسی #آموزش_پایتون #منطق_پایتون #پای_ویژن #Python #PythonChallenge #Coding #LearnPython #Programming #LogicOperators #PythonTips #PyVision 🌐 @PyVision
✅ پاسخ:
📘 در پایتون میتوانیم مقایسههای زنجیرهای انجام بدهیم؛
عبارت 1 < x < 10 یعنی:
اما در خط آخر، شرط x > 10 برقرار نیست،
پس نتیجهی نهایی False خواهد شد.
Python allows chained comparisons.
1 < x < 10 is the same as (1 < x and x < 10).
Since x > 10 is False, the last line prints False.
#️⃣ #پایتون #کدنویسی #چالش_پایتون #برنامهنویسی #آموزش_پایتون #منطق_پایتون #پای_ویژن
#Python #PythonChallenge #Coding #LearnPython #Programming #LogicOperators #PythonTips #PyVision
🌐 @PyVision
True
True
False
📘 در پایتون میتوانیم مقایسههای زنجیرهای انجام بدهیم؛
عبارت 1 < x < 10 یعنی:
(1 < x) and (x < 10)
اما در خط آخر، شرط x > 10 برقرار نیست،
پس نتیجهی نهایی False خواهد شد.
Python allows chained comparisons.
1 < x < 10 is the same as (1 < x and x < 10).
Since x > 10 is False, the last line prints False.
#️⃣ #پایتون #کدنویسی #چالش_پایتون #برنامهنویسی #آموزش_پایتون #منطق_پایتون #پای_ویژن
#Python #PythonChallenge #Coding #LearnPython #Programming #LogicOperators #PythonTips #PyVision
🌐 @PyVision
🔥2🤩1
پاسخ صحیح؟!🔥 👇🏽
Correct answer?!
#️⃣ #پایتون #کدنویسی #چالش_پایتون #برنامهنویسی #آموزش_پایتون #منطق_پایتون #پای_ویژن
#Python #PythonChallenge #Coding #LearnPython #Programming #LogicOperators #PythonTips #PyVision
🌐 @PyVision
Correct answer?!
x = 0
y = 1
if x or y and not x:
print("A")
elif not y or x and y:
print("B")
else:
print("C")
#️⃣ #پایتون #کدنویسی #چالش_پایتون #برنامهنویسی #آموزش_پایتون #منطق_پایتون #پای_ویژن
#Python #PythonChallenge #Coding #LearnPython #Programming #LogicOperators #PythonTips #PyVision
🌐 @PyVision
🔥2🤔1
خروجی چیست؟ 🤔
What's output?
📌 نکته: مقدارهای i و j را مرحلهبهمرحله دنبال کنید؛
اما مراقب باشید! بعضی از دورهای حلقه اصلاً اجرا نمیشوند.
#️⃣ #پایتون #کدنویسی #چالش_پایتون #برنامهنویسی #آموزش_پایتون #منطق_پایتون #پای_ویژن
#Python #PythonChallenge #Coding #LearnPython #Programming #LogicOperators #PythonTips #PyVision
🌐 @PyVision
What's output?
result = 0
for i in range(3):
for j in range(i):
result += j
print(result)
📌 نکته: مقدارهای i و j را مرحلهبهمرحله دنبال کنید؛
اما مراقب باشید! بعضی از دورهای حلقه اصلاً اجرا نمیشوند.
#️⃣ #پایتون #کدنویسی #چالش_پایتون #برنامهنویسی #آموزش_پایتون #منطق_پایتون #پای_ویژن
#Python #PythonChallenge #Coding #LearnPython #Programming #LogicOperators #PythonTips #PyVision
🌐 @PyVision
👍2
خروجی چیست؟🤔
What's output?
#️⃣ #پایتون #کدنویسی #چالش_پایتون #برنامهنویسی #آموزش_پایتون #منطق_پایتون #پای_ویژن
#Python #PythonChallenge #Coding #LearnPython #Programming #LogicOperators #PythonTips #PyVision
🌐 @PyVision
What's output?
x = 3
y = 0
while x > 0:
y += x % 2
x -= 1
print(y)
#️⃣ #پایتون #کدنویسی #چالش_پایتون #برنامهنویسی #آموزش_پایتون #منطق_پایتون #پای_ویژن
#Python #PythonChallenge #Coding #LearnPython #Programming #LogicOperators #PythonTips #PyVision
🌐 @PyVision
🔥3
✳️ خروجی چیست؟🤔👇🏽
✳️ What's the output?
#️⃣ #پایتون #کدنویسی #چالش_پایتون #برنامهنویسی #آموزش_پایتون #منطق_پایتون #پای_ویژن
#Python #PythonChallenge #Coding #LearnPython #Programming #LogicOperators #PythonTips #PyVision
🌐 @PyVision
✳️ What's the output?
x = 5
y = 0
for i in range(3):
if (x % 2 == 1) and not (i == 1):
y += i
else:
y -= 1
while x > 2 and y < 4:
if x % y != 0 or y == 0:
x -= 1
y += 2
else:
x -= 2
print(x, y)
#️⃣ #پایتون #کدنویسی #چالش_پایتون #برنامهنویسی #آموزش_پایتون #منطق_پایتون #پای_ویژن
#Python #PythonChallenge #Coding #LearnPython #Programming #LogicOperators #PythonTips #PyVision
🌐 @PyVision
👌3
✳️ خروجی چیست؟🤔
✳️ What's the output?
#️⃣ #پایتون #کدنویسی #چالش_پایتون #برنامهنویسی #آموزش_پایتون #منطق_پایتون #پای_ویژن
#Python #PythonChallenge #Coding #LearnPython #Programming #LogicOperators #PythonTips #PyVision
🌐 @PyVision
✳️ What's the output?
a = 0
b = 5
if a or b:
print("Yes")
else:
print("No")
#️⃣ #پایتون #کدنویسی #چالش_پایتون #برنامهنویسی #آموزش_پایتون #منطق_پایتون #پای_ویژن
#Python #PythonChallenge #Coding #LearnPython #Programming #LogicOperators #PythonTips #PyVision
🌐 @PyVision
🤩3
❓با توجه به کد زیر، خروجی نهایی دو دستور print چیست؟
و کدام یک از دو آبجکت a و b شناسهٔ (id) جدید میگیرد؟
❓️Given the code below, what is the final output of the two print?
And which one of the two objects, a or b, receives a new id?
🔍 نکتهٔ
● تاپل (tuple) غیرقابلتغییر است و += یک آبجکت جدید میسازد.
● لیست (list) قابلتغییر است و += روی همان آبجکت قبلی اعمال میشود.
#️⃣ #برنامه_نویسی #آموزش_پایتون #پای_ویژن
#Python #PythonChallenge #PythonTypes #CodingChallenge #PyVision
🌐 @PyVision
و کدام یک از دو آبجکت a و b شناسهٔ (id) جدید میگیرد؟
❓️Given the code below, what is the final output of the two print?
And which one of the two objects, a or b, receives a new id?
a = (1, 2, 3)
b = [1, 2, 3]
a += (4, 5)
b += [4, 5]
print(a)
print(b)
🔍 نکتهٔ
● تاپل (tuple) غیرقابلتغییر است و += یک آبجکت جدید میسازد.
● لیست (list) قابلتغییر است و += روی همان آبجکت قبلی اعمال میشود.
#️⃣ #برنامه_نویسی #آموزش_پایتون #پای_ویژن
#Python #PythonChallenge #PythonTypes #CodingChallenge #PyVision
🌐 @PyVision
🔥3
PyVision | پایویژن
❓با توجه به کد زیر، خروجی نهایی دو دستور print چیست؟ و کدام یک از دو آبجکت a و b شناسهٔ (id) جدید میگیرد؟ ❓️Given the code below, what is the final output of the two print? And which one of the two objects, a or b, receives a new id? a = (1, 2, 3) b = [1…
✅ پاسخ چالش
🔢 خروجی دستور های ()print:
🟢 در این چالش با تفاوت بین دو نوع دادهی مهم روبهرو هستیم:
● تاپل (tuple) یک نوع داده غیرقابلتغییر (immutable) است.
بنابراین عملگر += نمیتواند آن را در همان حافظه تغییر دهد و یک آبجکت جدید میسازد؛ به همین دلیل id(a) تغییر میکند.
● لیست (list) یک نوع داده قابلتغییر (mutable) است.
عملگر += روی لیست بهصورت in-place اجرا میشود و عناصر جدید به همان آبجکت قبلی اضافه میشوند؛ بنابراین id(b) تغییر نمیکند.
📌 نتیجه:
● a → آبجکت جدید میگیرد
● b → همان آبجکت قبلی باقی میماند
🟢 This challenge highlights the difference between mutable and immutable types in Python:
● A tuple is immutable, so the += operator cannot modify it in place.
Instead, Python creates a new object, which means the id of a changes.
● A list is mutable, and += modifies it in place.
New elements are added to the same object, so the id of b remains unchanged.
📌 Final result:
● a → gets a new object (id changes)
● b → stays the same object (id does not change)
#️⃣ #آموزش_پایتون #چالش #نوع_داده #برنامه_نویسی
#Python #PythonChallenge #PythonTypes #Programming #PyVision
🌐 @PyVision
🔢 خروجی دستور های ()print:
(1, 2, 3, 4, 5)
[1, 2, 3, 4, 5]
🟢 در این چالش با تفاوت بین دو نوع دادهی مهم روبهرو هستیم:
● تاپل (tuple) یک نوع داده غیرقابلتغییر (immutable) است.
بنابراین عملگر += نمیتواند آن را در همان حافظه تغییر دهد و یک آبجکت جدید میسازد؛ به همین دلیل id(a) تغییر میکند.
● لیست (list) یک نوع داده قابلتغییر (mutable) است.
عملگر += روی لیست بهصورت in-place اجرا میشود و عناصر جدید به همان آبجکت قبلی اضافه میشوند؛ بنابراین id(b) تغییر نمیکند.
📌 نتیجه:
● a → آبجکت جدید میگیرد
● b → همان آبجکت قبلی باقی میماند
🟢 This challenge highlights the difference between mutable and immutable types in Python:
● A tuple is immutable, so the += operator cannot modify it in place.
Instead, Python creates a new object, which means the id of a changes.
● A list is mutable, and += modifies it in place.
New elements are added to the same object, so the id of b remains unchanged.
📌 Final result:
● a → gets a new object (id changes)
● b → stays the same object (id does not change)
#️⃣ #آموزش_پایتون #چالش #نوع_داده #برنامه_نویسی
#Python #PythonChallenge #PythonTypes #Programming #PyVision
🌐 @PyVision
👍3🤩1
🧩 خروجی کد زیر چیست؟
🧩 What's the output?
#️⃣ #چالش_پایتون #حلقه_وایل #منطق_برنامه_نویسی #آموزش_کدنویسی
#PythonChallenge #WhileLoop #ProgrammingLogic #LearnPython #PyVision
🌐 @PyVision
🧩 What's the output?
x = 1
while x < 10:
if x % 3 == 0:
x += 2
continue
x += 1
print(x)
#️⃣ #چالش_پایتون #حلقه_وایل #منطق_برنامه_نویسی #آموزش_کدنویسی
#PythonChallenge #WhileLoop #ProgrammingLogic #LearnPython #PyVision
🌐 @PyVision
🤩2
❓️ خروجی کد زیر چیست؟
❓️What's the output?
#️⃣ #تعریف_تابع #چالش_پایتون #آموزش_پایتون #برنامه_نویسی
#PythonFunctions #PythonChallenge #CodingConcepts #LearnPython
🌐 @PyVision
❓️What's the output?
def add(x, y=[]):
y.append(x)
return y
print(add(1))
print(add(2))
print(add(3))
#️⃣ #تعریف_تابع #چالش_پایتون #آموزش_پایتون #برنامه_نویسی
#PythonFunctions #PythonChallenge #CodingConcepts #LearnPython
🌐 @PyVision
👌2
❓️ خروجی کد زیر چیست؟
❓️ What's the output?
#️⃣ #پایتون #چالش_پایتون #تابع_لامبدا
#ListComprehension #PythonChallenge #Lambda #LearnPython
🌐 @PyVision
❓️ What's the output?
nums = [1, 2, 3]
funcs = [lambda x: x + n for n in nums]
print([f(10) for f in funcs])
#️⃣ #پایتون #چالش_پایتون #تابع_لامبدا
#ListComprehension #PythonChallenge #Lambda #LearnPython
🌐 @PyVision
🔥2👍1
❓️ خروجی کد زیر چیست؟
❓️ What’s the output?
#️⃣ #چالش_پایتون #آموزش_پایتون #لیست_در_پایتون
#TrickyPython #PythonChallenge #PythonLists #LearnPython
🌐 @PyVision
❓️ What’s the output?
a = [1, 2, 3]
b = a
a += [4]
print(b)
#️⃣ #چالش_پایتون #آموزش_پایتون #لیست_در_پایتون
#TrickyPython #PythonChallenge #PythonLists #LearnPython
🌐 @PyVision
🔥1
🔥 چالش همراه با جایزه 🔥
❓ خروجی کد زیر چیست؟
⏰ مهلت ارسال پاسخ: امروز تا ساعت ۲۲
📩 ارسال پاسخ فقط در پیوی ادمین:
🆔️ @its_poryaa
🎁 جایزه: ۵۰ هزار تومان شارژ همراه
🎯 بین پاسخهای صحیح قرعهکشی میشود
⛔ ارسال پاسخ در کانال = حذف
⛔ ویرایش پاسخ = حذف
⛔ هر نفر فقط یک پاسخ
#️⃣ #چالش_پایتون #پایتون #برنامه_نویسی #چالش_جایزه_دار #آموزش_پایتون #کدنویسی
#PythonChallenge #PythonQuiz #LearnPython #PythonTricks #CodingChallenge #Programming
🌐 @PyVision
❓ خروجی کد زیر چیست؟
nums = [1, 2, 3]
funcs = [lambda x: x + n for n in nums]
print([f(10) for f in funcs])
⏰ مهلت ارسال پاسخ: امروز تا ساعت ۲۲
📩 ارسال پاسخ فقط در پیوی ادمین:
🆔️ @its_poryaa
🎁 جایزه: ۵۰ هزار تومان شارژ همراه
🎯 بین پاسخهای صحیح قرعهکشی میشود
⛔ ارسال پاسخ در کانال = حذف
⛔ ویرایش پاسخ = حذف
⛔ هر نفر فقط یک پاسخ
#️⃣ #چالش_پایتون #پایتون #برنامه_نویسی #چالش_جایزه_دار #آموزش_پایتون #کدنویسی
#PythonChallenge #PythonQuiz #LearnPython #PythonTricks #CodingChallenge #Programming
🌐 @PyVision
🤩1