Data Types - Arrays and Records

Description

A level Computing (1 - Fundamentals of Programming (1.1)) Slide Set on Data Types - Arrays and Records , created by Adele Tidball on 22/07/2020.
Adele Tidball
Slide Set by Adele Tidball, updated more than 1 year ago
Adele Tidball
Created by Adele Tidball over 4 years ago
6
0

Resource summary

Slide 1

    Data Type - Arrays: 1D/Lists
    Arrays - a data structure that can store a group of data values, of the same type, under the same name  They are the most useful when you have lots of related data that you want to store and it doesn't make sense to use separate variables - eg. names of people in a class  Element - each piece of data in an array - each element can be accessed using its position (or index) in the array Creating arrays:  Python - people = {"Mark", "Adam", "Shelly"} Pseudocode - people <- {"Mark", "Adam", "Shelly"}     2.. Retrieving elements:  Remember in pseudocode, positions are numbered starting at 0 and in python, positions are numbered starting at 1  Python - print people[1]  Pseudocode - OUTPUT people[0]
       3. Changing elements: Python - people[1] = "Tami" Pseudocode - people[0] <- "Tami"     4. Number of elements: Python - len(people) Pseudocode - LEN(people) Combining these array functions with FOR loops, will give you a systematic way of accessing and changing all of the elements in an array

Slide 2

    Data Type: Arrays - 2 Dimensional Arrays
    Creating arrays:  trees <- [['oak', 'ash'], ['beech', 'cedar'], ['pine', 'elm']] Positions of elements:  The position of an element is usually written [a][b] or [a,b], where a represents the separate list and b represents the position inside the individual lists.  trees[0][0] - oak  trees[0][1] - ash trees[2][0] - pine  Length of an array or a list in the array: Length of an array says how many individual lists there are in the array = LEN(trees) - 3  Length of a list in an array says how many elements there are in the list = LEN(trees[1]) - 2  
    Caption: : You can think of a 2D array as a grid or table

Slide 3

Show full summary Hide full summary

Similar

A level Computing Quiz
Zacchaeus Snape
Types and Components of Computer Systems
Jess Peason
Input Devices
Jess Peason
Output Devices
Jess Peason
Computing
Kwame Oteng-Adusei
Pack of playing cards answer
Karl Taylor
Code Challenge Flow Chart
Charlotte Hilton
Computing Hardware - CPU and Memory
ollietablet123
Computer Systems
lisawinkler10
Computer science quiz
Ryan Barton
Input, output and storage devices
Mr A Esch