Mapa mental
Year 9 Unit 3: Programming

Contenido del mapa
Year 9 Unit 3: Programming
Procedural Programs
- The simplest programs are Procedural – they are just a sequence of commands that run in order
- Functions tell a program to do something Each function does a different thing Examples: print() - displays some text in the console input() - gets some text from the keyboard round() - rounds a number to a given decimal place
- Random.randint() - generates a random whole number Random.random() - generates a random decimal number between 0 and 1 Turtle.forward() - moves a turtle forward
Data Types
- Whole Numbers (or integers) are stored using binary Words (or strings) are stored using ascii Real numbers (or floats) are stored using floating point binary True or False (or Boolean) can be stored using a single 1 or 0
- Maybe you’ve stored an input from the user (which will be a string), but you want it to be an integer. Maybe you have a number (real or integer), and need to add it onto the end of a string. Casting is the act of changing a variable’s data type. To cast a variable, you use the int(), str() or float() functions
Conditional Loops
- Using conditions, we can control when the code loops and stop it looping when we want it to.
- A condition is a statement that must be true in order for the loop to happen. If the condition becomes false, the loop stops.
- A while loop can be added into code to make certain lines repeat.
Python Console Programming
- Data is stored in a named store called a variable. It is called this because the data inside it varies – i.e. it can change. We can name variables anything we like, as long as it starts with a letter.
- input() is the second function we’re going to look at. Reminder: A function is a command which performs an action. input() displays a prompt in the console then waits for the user to type a response on the keyboard.
Loops and Variables
- Loops are used to repeat code. We use a loop when we identify a sequence of instructions that will be repeated multiple times. Sometimes this is just one instruction that is repeated, sometimes it is many instructions
- A variable is simply a name you assign to a value. This name can be used in place of the variable. As the name suggests, the value can vary (change) throughout the program.
- Loops are used to repeat code. We use a loop when we identify a sequence of instructions that will be repeated multiple times. Sometimes this is just one instruction that is repeated, sometimes it is many instructions
Selection
- Selection is another way to change the flow of a program. It’s simpler than iteration and doesn’t involve any repeating code.
- The program runs one section of code or another depending on a condition
- ELIF (short for Else If) can be used to add a second condition if the first one is false.
Imágenes y archivos del mapa
Información
- Descripción
- Mapa Mental sobre Year 9 Unit 3: Programming, creado por harvey asher el 04/03/2022.
- Creado por
- harvey asher
- Visitas
- 0
- Valoración


