Chapter 33 - Arrays, tuples and records Flashcards
What is an elementary data type?
» Integer
» Real
» Boolean
» Char
» String
What are some examples of built-in structured data types such as string, array and record?
» String
» Array
» Record
What is an array?
» Data structure which contains a set of data of items of the same data type
» Static data structure - size cannot be changed
» Stored contiguously in memory
What does it mean by finite?
» There is a specific number of elements in the array
What does it mean by ordered?
» Implies that there is a first second, third elements of the array
What position do arrays always start at?
» Position 0
What is an Index?
» A reference that is helpful to reference each element in the array, such as array[0]
How can a 2-D array be visualised as?
» Visualised as a table
How can you refer the elements in the 2-D array?
» By their row number then column number
» Such as array[rownumber, columnnumber]
What position in the array is it when the user ask to input row number 1?
» Prints the 0th row, as the array starts at 0
How can you make a 2-D array in python?
» Array = [[100,200,300],[500,400,200]]
What is an important rule when making 2-D arrays in python?
» Must always be separated by a comma
What is the first element in a 3-D array?
» [0,0,0]
What is a Tuple?
» An ordered set of values
» Which could be elements of any type
» Which are immutable
How are Tuples different from arrays?
» Unlike arrays, the elements do not all have to be of the same type