TGViewer
PyCoders (پایتون) PyCoders (پایتون) @python_rd · 4.1K subscribers
Post #2237 259
🔆 خروجی این تکه کد چیه؟

def add_item(item, lst=[]):
lst.append(item)
return lst

print(add_item(1))
print(add_item(2))
print(add_item(3, [9, 9]))
print(add_item(4))

🔹گزینه‌ها:

الف) [1], [2], [9, 9, 3], [4]
ب) [1], [1, 2], [9, 9, 3], [1, 2, 4]
ج) [1], [2], [3], [4]

🐍 @python_rd
More from @python_rd
  1. Oct 13, 2026کوییز پایتون 🔆 خروجی اجرای کد زیر چیست؟ t = (1, 2, [3, 4]) try: t[2] += [5] except TypeEr…
  2. Oct 13, 2026🔆 راز مکانیزم پیاده‌سازی و تغییر جهت NaN در الگوریتم مرتب‌سازی پایتون (Timsort) 🔹 باگ ری…
  3. Oct 13, 2026🔆 حذف تاریخی GIL از پایتون (Free-threaded Python) 🔹 یک رویداد تاریخی: حذف قفل مفسر (GIL)…
  4. Oct 11, 2026🔆 مدیریت تمیز منابع با Context Managerهای سفارشی (contextlib) 🔹 ساخت Context Managerها م…
  5. Oct 10, 2026🔆 چرا برای داده‌های حجیم نباید از return استفاده کنی؟ 🔹 وقتی یک تابع لیست بزرگی از داده‌…
  6. Oct 10, 2026🔆 مدیریت منابع با contextlib 🔹 از تکرار try...finally برای بستن فایل‌ها و اتصال‌ها خسته…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →