0% found this document useful (0 votes)
3 views8 pages

Using Arrays (Lists) in Python

The document explains the concept of lists (arrays) in Python, highlighting their characteristics such as being ordered, changeable, and capable of storing various data types. It covers how to create, access, modify, and perform operations on lists, along with real-life examples like storing student marks and managing shopping lists. The conclusion emphasizes the efficiency and importance of lists in programming.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views8 pages

Using Arrays (Lists) in Python

The document explains the concept of lists (arrays) in Python, highlighting their characteristics such as being ordered, changeable, and capable of storing various data types. It covers how to create, access, modify, and perform operations on lists, along with real-life examples like storing student marks and managing shopping lists. The conclusion emphasizes the efficiency and importance of lists in programming.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

USING ARRAYS

(LISTS) IN PYTHON
COMPUTER SCIENCE

What lists are


How to use them in Python
What is an Array (List)?
A list is a collection of items
stored in one variable
Items can be numbers, strings,
or mixed
Lists are ordered and
changeable

numbers = [1, 2, 3, 4]
ing and Accessing
Cr eat
Lists
ua re br a ck et s []
ts us in g sq
Create lis s ta rt s at 0)
t s us ing in de x (
Access elemen

fruits = ["apple", "banana", "cherry"]


print(fruits[0]) # apple
MODIFYING LISTS
Change values using index
Add items using .append()
Remove items using .remove() or .pop()
n L is t Op e r a t ions
Com m o
len(list) → number of items
sum(list) → total (numbers only)
max() / min()
Sorting with .sort()
al-Life Example
Re
Storing student marks
Managing shopping lists
Game scores

marks = [85, 90, 78]


print(sum(marks))
Conclusion

Lists store multiple values efficiently


Easy to modify and use
Important for real programs
Thank you for your
attention
Muhammadxo’ja SHuhratov
7-blue

You might also like