Paper 2 revision
Slides in this set (12)
-
- Definition: Choosing an option in code that could affect an outcome of a piece of code.
- x = 5
- y = 8
- if x < y:
- print("y is greater than x") #This code will print different outcomes based on x and y.
- elif y < x:
- print(" x is greater than y")
- else:
- print("x and y are equal")
-
- Definitions: iterations are loops.
- for x in range (1,10): #This code will run 9 times.
- print(x)
- for x in range (1,6): #This code will run 5 times
- print("Hello World!")
-
- Definition of div: Gives you a whole figure and ignores all numbers after the decimal point.
- Definition of mod: Gives you the remainder of a calculation.
-
- Syntax error: An error that occours when there are simple spelling errors in the code. This is highlighted in red at the bottom of the code when it is being attempted to run.
- Logic error: An error that occours when a program doesn't produce the desired outcome. E.g. if an inequality sign is the wrong way round. These will not be highlighted in red and is one of the most hard errors to find in long pieces of code.
- Run-time error: An error that occours when an the code tries to attempt an impossible task. One of the most common run-time error is dividing by zero. This will be highlighted in red at the bottom.
-
- There are three types of logic gate:
- And Gate: Looks like this: =D- The output is always zero unless both inputs are 1.
- Not Gate. Looks like this: ->- The output is always the opposite of the input.
- Or Gate Looks like this: =)>- The output is always 1 unless two zeros are inputted.
-
Standard sorting algorithms #1
- Bubble sort: Swapping items in a list until they are in the correct order.
- 86, 4, 21, 34, 98, 65, 15, 78, 45, 32, 1, 2
- 4, 86, 21, 34, 65, 98, 15, 78, 32, 45, 1, 2
- The process repeats until they are in the correct order.
-
Standard sorting algorithms #2
- Merge sort:
-
- There are many different operators in Python. We can use these in a variety of ways.
- = or == means is equal to.
- > means greater than
- < means less than.
- <> or != means not equal to.
-
- integer: a whole number.
- float/real: a decimal number
- string: a sentence, word or phrase in speech marks.
- boolean :a true of false statement.
-
- There are many operators we use to change textfiles such as read, write, , open and close. These are all followed by brackets so we can change variables or add strings into the brackets.
-
- SELECT * FROM Name WHERE VariableName ="Hello":
-
- High level languages: Languages with a wider range of definitions, meanings and is generally more harder than low level. Examples include Source code, assembler, compiler and interpreter.
Information
- Description
- Slide Set on Paper 2 revision, created by Harriet Leplar on 07/06/2019.
- Created by
- Harriet Leplar · Jun 2019
- Updated
- Jul 8, 2019
- Views
- 14
- Rating