Additional programming techniques Flashcards
Array
Data structure that can hold a fixed number of data elements. Each data element must be of the same data type
The elements in an array are identified by their position in the array. This is known as the index. The first element in an array always has an index of 0
Traversing an array
To traverse (move through) an array a for loop can be used to display each data element in order
e.g. ArrayName = [“Dog”, “Cat”, “Snake”]
for name in ArrayName:
print(name)
‘Inserting’ a value in an array
In an array, the size is fixed so you cannot insert new values, but you can change the value of elements that already exist
e.g. ArrayName[3] = “Dog”
‘Deleting’ a value in an array
In an array the size is fixed so you cannot delete values, but you can overwrite them as blank
e.g. ArrayName[2] = “”
Searching an array
For large arrays, a for loop is needed to search through each element for a specific value
e.g. for name in ArrayName:
if name == “Dog”:
print(name)
SQL
Searches for data in a database
SELECT (from top layer of table)
FROM (table name)
WHERE