Monday, 24 February 2014

3.1.3 Defining flow control

To start/stop the flow chart you must have a sausage type shape
To process or make a statement you must use a rectangular shape
To ask a question you must use a diamond shape with a yes and no line coming off of it and going to to a process 

3.1.3 Program flow control

Sequence - A set of instructions in an order.  each action follows the previous one
Selection - If statements, choice, pathways through code
Iteration - Looping or repeating actions

3.1.2 Linked Lists


In computer science, a linked list is a data structure consisting of a group of nodes which together make a sequence. Each node is made up of some data and a reference (in other words, a link) to the next node in the sequence.

3.1.2 Two Dimensional Arrays

A Two Dimensional Arrays is a list of lists. For example a game of darts Turn (a list of the scores of 3 darts in a players )
Leg (a list of the turns a player has in that leg)
19
60
20
20
20
60
60
60
60

Wednesday, 5 February 2014

3.1.1 The purpose of data types within code


Data can be kept in many different forms
A computer uses special internal codes to keep track of the different types of data that it processes

Programming languages use different data types to make best use of space.  E.g. Floats take up more room than integers.

3.1.1 Naming Variables


A variable name can be as short as a single letter, but it cannot be a number e.g.
a = ...... (good)
9 =.......(bad)

The name of a variable can start with a underscore ( _ )
A good variable name is specific to the information being stored.  E.g. firstName

3.1.1 The Difference between a variable and a constant

Some data needs to change throughout a program (variable)

Some data must stay the same, and must not change (constant)

In the c programming language, a constant is defined like this:
int const a = 1;


3.1.1 Variables


Variables in a computer program can be thought of as "Buckets" or "Envelopes" where information can be stored in computer memory and referenced. On the outside of the bucket is a name. When referring to the variable, we use the name of the variable, not the data stored in the variable.
This is an example of a variable E.g.
name = “Bob”
age = 19
dob = “26/08/2004”

print(name)

Bob

3.1.2 Arrays

Arrays can also be called Table Arrays.  In Python, you are used to them being called Lists.

Arrays are lists of data that can be accessed by giving an index number.  Remember indexing in computing begins with 0 and goes 1 etc. E.g
studenta = ["Aimee","Jones","10PHD","26/09/2003"] studentb = ["Harry","Moore","10PHD","26/10/2003"] studentc = ["Horrace", "Ransom", "10PHD", "13/10/2013"] studentd = ["Shaniqua", "Tingtongmakadangdang", "10STD", "13/10/1797"]

Adds the students to the students list
students.append(studenta) students.append(studentb) students.append(studentc) students.append(studentd)
print(students[3][1])
so this will print "Shaniqua"


3.1.2 Data Structures

Computer programming is about making a set of instructions to solve a problem, or complete a task

Data structures help organise data, so it’s easier to work with and suitable for computer processing.

In Python, we have made data structures called lists. names = ["Jared","Jack","Bob"]

The list must say = [] before putting an item in the list e.g

manUnited = []