Please enable JavaScript.
Coggle requires JavaScript to display documents.
9.1 Python and programming - Coggle Diagram
9.1 Python and programming
variables
Assigning a value to a variable using user input
String
Data types
Integer = Used for whole numbers.
Float/Real = Used for decimal numbers.
String = Used for text.
Assigning a value to a variable
a string
an integer
Definition
= A memory location within a computer program where values are stored.
Outputing the value of a variable
Output the value of a variable
Output the value of the variable and a message
Separators
We can use a '+' to join strings together.
calculations using division
Whole number = //
remainder = %
Subroutines
Definition = A section of code written outside of the main program. The umbrella term for procedures and functions.
Function
The same as a procedure but it returns a result back to the main programme.
Procedure
A procedure is a subroutine
that performs a specific task.
Selection
definition
when your programme has to make a choice
complex if statement
Using an 'elif' we can see if a 2nd condition is met if the 1st one isn't.
Nested if statement
When using a nested if statement we can see if something else is true if the first condition is met.
Iteration
While loop
We use this if we want code to repeat until a condition is met
For loop
We use this if we want to repeat some code a certain number of times