1/21
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No study sessions yet.
Arrays
A collection of items stored in memory. Each item can be selected using indexes. Can't be changed after created.
names = ("Ryan", "Brad", "Jimmy", "Steph")
Lists
A collection of items stored in memory. Each item can be selected using indexes. Differ from arrays as they can be changed after creating.
place = ["London", "Paris", "New York", "Tokyo"]
Procedures
A block of code with a name we want to reuse.
Functions
A block of code with a name we want to reuse and be able to pass values to it and get values back (Return).
We use them to make code shorter and it stops us having to write the same code over and over.
Data Type
The Classification of a piece of data.
Integer
A whole number (Positive or Negative).
Real (Float)
A number with a decimal point.
Arithmetic Operators
The operations used in calculations:+ " Add- " Subtract " "Multiply / Divide"^ " Exponent (To the Power Of) (* in Python)MOD " Modulo Division (Remainder) (% in Python)DIV " Integer Division (// in Python).
Add
+
Multiplication
*
Divide
/
MOD
Returns the remainder e.g. 9 MOD 4 returns 1, as that is what is left.
Character
A single alphanumeric character.
String
A sequence of characters.
Boolean
A single value of either TRUE or FALSE.
Iteration
Repetition - When something loops.
Greater than
When a number is larger than the other number. Example 65 > 56.
Less than
Less than is used to compare two numbers when the first number is smaller than the second number. Example 14 < 65.
Variable (Programming)
Used to store information in our program.
Selection (Programming)
Allows the computer to make a selection between alternative conditions; decisions choice, if/else.
if speed > 70:
print("Too fast, get a fine")
else:
print("Well done, driving is nice and steady")
Loop/iteration
FOR and WHILE can be used for iteration (repeating a series of instructions). For is used when we know how many times to repeat code, while when we don't. E.g.
while score < 50:
for i in range (0,3):
Parameter
A piece of data passed to a function from the main program - like a variable that allows the function to operate on specific inputs.