Working with Lists
A list is an ordered collection of items. Instead of creating separate variables for each stock in a portfolio, you can store them all in a single list.
Creating Lists
جارٍ تحميل ساحة تجربة Python...
Accessing List Elements
Lists are indexed starting from 0 (the first item is at position 0):
جارٍ تحميل ساحة تجربة Python...
Modifying Lists
Lists are mutable - you can change their contents:
جارٍ تحميل ساحة تجربة Python...
Useful List Operations
جارٍ تحميل ساحة تجربة Python...
List Slicing
Extract portions of a list:
جارٍ تحميل ساحة تجربة Python...
Sorting Lists
جارٍ تحميل ساحة تجربة Python...
Practice: Portfolio Analysis
جارٍ تحميل تمرين Python...
Practice: Calculate Portfolio Value
جارٍ تحميل تمرين Python...
Key Takeaways
- Lists store ordered collections of items
- Access elements with
[index], starting from 0 - Negative indices count from the end:
[-1]is the last item - Use
append()to add items,remove()to delete len(),sum(),max(),min()work on lists- Slice with
[start:end]to extract portions sorted()creates a sorted copy,.sort()modifies in place
Next, we'll learn about dictionaries - storing data with meaningful labels like ticker symbols!
التالي · الدرس 6 من 26
Working with Dictionaries
قراءة 1 دقيقة
أنهيت 5 من 26 درسًا

اسأل Byte عن هذا الدرس
محادثة خاصة حول هذا الدرس. قرأ Byte الدرس كاملًا، ويجيب خلال ثوانٍ، ويُظهر القسم الذي تأتي منه كل إجابة. يمكنك السؤال بأي لغة.
الأسئلة والأجوبة
أسئلة عامة حول هذا الدرس. يجيب AI Tutor فورًا بلغتك، ويراجع فريق FreeAcademy الإجابات، ويمكن لكل المتعلمين قراءتها.

