ENع
الدرس 08 · Collections and functions

Dictionaries and sets

لم يُترجم بعد؛ يُعرض باللغة الإنجليزية

A list finds things by position. A dictionary finds them by name: it stores key: value pairs, so ages["Ana"] gives Ana's age straight away. Step through a seven-line program, ages.py, that builds a dict, adds a pair, changes a value, looks keys up (safely, with get()), then builds a set and watches it drop a duplicate. Along the way, see the trick that makes both fast: Python hashes each key to work out where it belongs.

12 دقيقة9 خطوات5 أسئلةBeginner
شكل 8 · تفاعلي
جارٍ تحميل الرسم…
أو ← →

اختبار يتاح بعد الخطوة الأخيرة.