Friday, January 31, 2014

3.1.2 Two Dimentional Arrays

Two dimensional arrays are list of lists. this means that it is constructed of multiple lists.
 In python a two dimensional array is used with rows for example row 1 is zero and the row contains letters. Lets say you want to select a letter such as b.
 you would say : print (letter[0][1])
 An example of two dimensional array in python is :
Useful link : http://www.processing.org/tutorials/2darray/

3.1.2 Arrays

Arrays also known as table arrays are lists of information that can be accessed by index numbers.
 Lists always begin with 0.,
For example: 0 1 2 Jim Jimmy Jamie
(0 = Jim 1 = Jimmy and 2 = Jamie
 The equivilent of arya in python are called lists. Lists in python can be different, for example there are 2 dimentional arrays( Covered in the next post) and 3 dimentional arrays. 3 Dimentional arrays in python are basicly a list inside a list inside a list, for example : day [Monday, Tuesday, Wednesday, Thursday ,Friday] week [One,Two,Three,Four,Five] year [2000,2001,2002,2003,2004] Year info = ("Thursday" "Four" "2003")

3.1.2 Data Structures

Computer programming is about creating instructions to do tasks such as problem solving or to complete a task.
Data structures can help organise data. so that is easier to use and that is is suitable for computer processing. Data structures in python are called lists.
 For example: cars = ["Subaru Imprezza 2004","Maclaren F1","Sesto Elomento"]


Useful webpage :http://en.wikipedia.org/wiki/Data_structure

Thursday, January 30, 2014

3.1.1 Variables

A Variable in a computer can be seen as a bucket( or an envelope) because information can be stored and maintained.
You can think that a variable is like a bucket or an envelope because you can store stuff in a bucket and in a envelope ( just imagine the stuff is data when thinking it as a variable).
The bucket is named after the variable.
 For example bucket = Name
When you are referring to a bucket you use the name of the bucket, not the information stored in it.
for example :
age = 17 (age is the bucket, 17 is the information stored inside of it)
name = Sam (name is the bucket, Sam is the information stored inside of it)
dob= 03/09/1995 (dob is the bucket, 03/09/1995 is the information stored inside of it)

Source :http://python4kids.wordpress.com/2010/07/07/some-foundations-variables-and-stuff/


Friday, January 24, 2014

3.1.1 Data Types

Intergers are either positive or negative numbers, they must be a whole number. For Example : 1,3,9,5,3,1,2,4,2,1,6,9

Real/float point numbers: are decimal numbers,they are very accurate but are quite slow. they are used for making exact measurements.

Data/Time : are used to store dates and times for example in Europe 1.5.14 is the first of may 2014 but in america is is the 5th of January 2014. Strings strings are a line of characters.They could contain special characters and letters.

strings in python are represented by a ("").
 (Source: http://answers.yahoo.com/question/index?qid=20110711103410AADTHOY)
 Booleans: Booleans in python are yes or no, true or fault scripts other examples of booleans are OR, AND ,NOT.
My python boolean test script:








data type used : Equal to.

3.1.1 The purpose of data types within code

Data can be stored in different forms.
 A PC uses different type of internal codes to store the different of types of data being processed currently.
Programming languages uses different types of data so that it can use us the space it has available more efficiently. for example strings(32 bit) take up more room then char(8 bit) thus making char the more efficient data type to use.
Also the less bits a data type has the more faster it is. although on some data types the more bits it has it makes the data type more accurate.
Less bits = faster but less accurate
More bits = slow but accurate
The data types determine what functions can be done.
 For example: the use of numbers.
Here are a list of data types and how many bits it contains.

Useful webpages :http://en.wikipedia.org/wiki/Data_type

3.1.1 Naming Variables

A variable cannot be a number, but it can be letters or words. Any variable can begin with a _.
A good variable name is any word that is suitable for what ever the project is.
For example if your are making a track recording program, it would be suitable to name the variable lapTime.
While you can name your variable almost everything, you cannot name a variable after a function. E.G : print.


Useful webpage: http://en.wikipedia.org/wiki/Variable_(computer_science)

Thursday, January 23, 2014

3.1.1 The difference between a variable and a constant

A variable in python is a a number or a letter that represents a value, for example in python: Day = "tuesday" is a variable. A variable can be changed. A constant is used in the programming language called C, a constant is different from a variable because a constant is always the same, for example : 2+3 = 5 always stays the same.
Useful webpages : http://www.codingunit.com/c-tutorial-variables-and-constants

Friday, January 17, 2014

3.1.1 Data and Infomation

Data can be either facts or just statistic. Any piece of data by it self has no meaning. ( it is out of conext) For example 1,2,4,3,3,4,3 has no meaning. Infomation on a computer can either be a sentence or an image that has been put into context. For example if you add infomation to the data it will make sense,for example: Number of planets found the past year: 1,2,4,3,4,3 This would also be in context.

Thursday, January 16, 2014

Driver info

name = input("What is you driver name:") - a variable allowing you to type your desired name trackname = input("What is the name of the track:") -variable allowing you to type your desired track car = input("What is your car:")-variable allowing you to type your desired car tracklength = input("What is the length of the track:")-variable allowing you to type track length in print ("Driver name:",name)-this is printing driver name with the infomation from the variables above print ("Track:",trackname)-this is printing track name with the infomation from the variables above print ("Car:",car)-this is printing car model with the infomation from the variables above print ("Track length:",tracklength)-this is printing the trac length with the infomation from the variables above Laps = [] lapTime = 1- lap time has to be 1 or more while lapTime != 0: if number is not equal to zero repeat this function lapTime = float(input("Time around Lap:"))- this allows you to type in any number to your track time, even decimals thanks to the float(input section of code Laps.append(lapTime)- place the laps in a list Laps.pop(-1) - take the last lap off the trac record print(Laps)- diplay lap times fastestLap = Laps[0]- this gets all the lap times into a list for Lap in Laps: if Lap < fastestLap: fastestLaps = Lap print (fastestLap) - after it has cearched for the fastest lap it displays it to the pragrammer