المكرّرات والمولّدات في بايثون
تعلّم كتابة كود أكثر كفاءة في الذاكرة باستخدام yield والمولّدات.
🐍 Try Python right here
Write code below and click Run — it executes right in your browser, nothing is sent to any server.
Output will appear here.
الدروس
1
دالة مولّدة بسيطة
yield تجعل الدالة تُرجع قيمًا واحدة تلو الأخرى دون تخزين كل شيء في الذاكرة دفعة واحدة.
✏️ Practice this lesson:
Output will appear here.