Topic Name: Python Programming Key
Words
(highlighted)
1: Key Words 2: Printing 3: Variables
Algorithm: A set of instructions or code used to solve a To print out a statement or a variable we use the Variables are simply a place on the computer's
problem.
code below: memory that is given a name in order for it to
Syntax: The rules of the programming language that need to remember it.
be followed in order for it to work. Printing a new message: LINK
print(“Hello World”); In Python you create a variable by writing the
Variables: Data that is stored in memory that is likely to name of the variable followed by an =.
change. Extended
reading
Program: Code compiled together to perform a specific Printing the value of a variable: Examples:
function. print(x); name = “Spongebob”;
age = 14;
4: Data Types
Printing a message with variables included: LINK
String: A Variable data type that can store a combination of print(“Hello”,name,”your are”,age,”years old
6: Selection
letters, characters and numbers. today”); Example
Questions
Integer: A Variable data type that can store whole numbers. Selection is used to allow the program to make a
choice and take a different path. /Tasks
Float: A Variable data type that can store decimal numbers.
Boolean: A Variable data type that stores either TRUE or The keywords used in Python are:
FALSE.
if - checks if the condition is true, if so the
7: Iteration KS3 Computer LINK
LINK program runs the indented code below it.
Science Video
Iteration is used to repeat a set of instructions or commands in elif - if the first if fails then this elif condition is links
a program. It saves having to write them all out over and over checked, there can be multiple of these.
again. 8: Inputs
There are two loops in Python programming: else - if all if and elif statements are not true the the
While - Checks if a condition is true and while it is true will keep To allow your Python program to get information from code indented below else will run.
repeating it. the user you will need to use the input command.
Make sure you use the correct command for what you LINK
For - Runs for a specific amount of times and stops when it
Example:
are asking for.
reaches the desired number.
Revision
String inputs (such as a name): colour - input(“Enter your favourite colour”); techniques
Examples: input(“Enter your name”); if colour == “Red”:
while answer != “London”:
print(“Reminds me of tomatoes”);
answer = input(“What is the capital of London?”);
Integer Inputs (for whole number responses): elif colour == “Blue”:
Or
int(input(“What is your age?”)); print(“Reminds me of the sea!”);
else:
for i in range(5): Float Inputs (for decimal number responses):
float(input(“What is your shoe size?”)); print(“If it ain’t Red or Blue then I ain’t
movie = input(“What is one of your top 5 favourite movies?”) LINK
interested”);