Mapa mental
Chapter 1 – Programming Basics
Contenido del mapa
Chapter 1 – Programming Basics
Input/output Statements
- Input statement allows the user to enter data
- Eg. USERINPUT
- Output statement allows the program to display/print data
- Eg. OUTPUT
- Input statement allows the user to enter data
Comments
- Used to show what each bit of the code does, documenting who made it, the time and date of creation/last revision etc.
- Shown using a #
Data Types
- Integer - a whole number Eg. -25, 0, 3, 54842
- Boolean - a variable that can only be TRUE or FALSE
- Character = a letter, number or special character that is represented in ASCII. Eg. A, ?, 4
- String = anything enclosed in speech marks. Eg. "Dan"
- Real/Float - a number with a fractional part Eg. -13.5, 0.0, 3.142
Common Arithmetic Operators
- -,+,* and / are common arithmetic operators
- Used in most programming languages and pseudocode
- -,+,* and / are common arithmetic operators
Exponentiation
- To find a square of a number (eg. 25) you need to use exponentiation
- In pseudocode written as x ← y**n
- To find a square of a number (eg. 25) you need to use exponentiation
Finding a Remainder
- Found using the mod function – written % in python
- Returns just the remainder
- Eg. 20%3 = 2 i.e. the remainder is 2.
- Found using the mod function – written % in python
Integer Division
- Found using the div function – written // in python
- Eg. 20//3 = 6
- Found using the div function – written // in python
String Handling Functions
- Concatenating Strings
- To concatenate means to join two strings together
- Use the + operater to do this
- Eg. "Johnny" + "Bates" = "JohnnyBates"
- To concatenate means to join two strings together
- String Conversion Operations
- int("1")|Converts a character to an integer. Eg. "1" would become 1
- float("123.456")|Converts a string to a real number. Eg. "123.456" would become 123.456
- str(123.456)|Converts a real number to a string. Eg. 123.456 would become "123.456"
- date(year,month,day)|Returns a number that you can use to calculate with. i.e turn into a string.
- str(123)|Converts a integer to a string. Eg. 123 would become "123"
- Constants
- Constants are values that never change throughout the program
- Makes is so the programmer cannot accidentally change the data
- Constants are values that never change throughout the program
- Variables
- Variables are identifiers (ie. Names) given to data that can change throughout the program
- Names should be meaningful to the data contained
- Easier for other programmers and you to follow and make changes
- Names should be meaningful to the data contained
- Variables are identifiers (ie. Names) given to data that can change throughout the program
- Some programming laguages require that you declare the varables and constants you want to use in your program before you can use them in the program.
- Concatenating Strings
Información
- Descripción
- A level (3.1) Computing Mapa Mental sobre Chapter 1 – Programming Basics, creado por Daniel Mapplebeck el 09/03/2017.
- Creado por
- Daniel Mapplebeck
- Visitas
- 2
- Valoración