One Pager Cheat Sheet
- We will discuss
arrays
and learn how tostore
andmanipulate
multiple data values in our program. - Arrays are a
data structure
that can store a collection of values withindexes
and a specificlength
, making it easier to group similar elements in a program. - In Python,
lists
are used to store multipleelements
of differentdata types
, such asstrings
andintegers
. - Both examples of list initialization in Python, with different data types stored as elements, are valid, and neither would generate an error.
- Various operations such as
adding
,removing
,searching
andprinting
, can be done onarrays
to make their usage in programming more efficient. - In Python, list operations such as
append()
,pop()
,remove()
, andlen()
can be used to manipulate and access information about lists (or arrays). - The
.append()
and.pop()
methods of lists are used to add elements and remove the element at index 2 respectively, resulting in the list ["Ford", "BMW"]. - The code provided will output 7, as this is the element located at index
2
in the listnumbers
of elements3, 2, 5, 7, 3, 6
, due to Python'sindexing
starting from 0 for the first element. - We discussed arrays and the variety of
operations
that can be performed on them, which can help us to create meaningful programs and applications.