Please enable JavaScript.
Coggle requires JavaScript to display documents.
Unit 2a - Programming Basics 1) Data Types and Operations (Variable types…
Unit 2a - Programming Basics
1) Data Types and Operations
Variable
A small piece of information stored by a computer program which can be changed by the program.
Constant
A variable which cannot be changed by the program. Not used in python, but is used in most other languages.
Variable types
Boolean Operator
Yes or no, On or Off, True or False etc.
Basically has 2 options
Theoretically just 1 bit, but in
high level languages,
actually 1 byte
Integer
A whole number
2 bytes
Real Number/Float
A decimal number
4 bytes
Character
And individual character, e.g. any 1 digit number, letter, or punctuation symbol
1 byte
String
A group of characters
1 byte per character
There are others
but these are the
main ones
Arithmetic Operators
Brackets
()
Orders or pOwers
a^b
Multiplication
*
Division
/ = Divide
DIV = Integer division
MOD = Returns the
remainder when
doing Integer Division
Addition
+
Subtraction
-
String handling functions
len(STRING)
Returns the length of a given string
position(STRING,CHAR)
Returns where in a string a certain character falls
substring(INT1,INT2,STRING)
Returns everything in the
string within the given range