
This course includes our updated coding exercises so you can practice your skills as you learn.
See a demo
Learning Intentions:
LEARNING INTENTIONS:
LEARNING INTENTIONS:
if - statement: A block of code that runs if a condition is true. For example:
if ( x > 5):
print('x is bigger than 5')
if-else statement: A block of code that specifies two different actions, one will take place if the condition is true, the other if the condition is false.
if ( x > 5):
print('x is bigger than 5')
LEARNING INTENTIONS:
1. Define and use a for-loop to repeat a print statement any number of times
2. Write a program which asks user for a number, and converts the user input into an integer. The program will then return a times table for that number
for loop: a piece of code that runs itself repeatedly. For loops run through a range of numbers and so they run a limited number of times.
iteration: to use a loop to go through a list or a range, and perform an operation with each item in that list / range
LEARNING INTENTIONS:
1. Define and use a for-loop to repeat a print statement any number of times
2. Use the for loop and the looping variable to create a program that asks a user for a number and then returns a times table
GLOSSARY:
for loop: a piece of code that runs itself repeatedly. For loops run through a range of numbers and so they run a limited number of times.
iteration: to use a loop to go through a list or a range, and perform an operation with each item in that list / range
LEARNING INTENTIONS:
GLOSSARY:
factors: Factors are numbers we can multiply together to get another number:
Example: 2 and 3 are factors of 6, because 2 × 3 = 6.
Factors come in pairs and prime numbers have only one pair of factors eg 11 can only be made from 1 × 11
remainder(%) : The % operator returns the remainder of a division of numbers so for example
5%2 = 1 5 divided by 2 leaves 1 remainder
10%2 = 0 10 divided by 2 is exactly 5 with zero remainder
prime number: a number that is only divisble by 1 and itself
LEARNING INTENTIONS:
GLOSSARY:
function: function is a block of code that has a name and the entire block can be run just by calling the name of the function. Functions have the ability to take in information as well as to output information
parameters: these are inputs to a function
def functionName(parameter1, parameter2, parameter3) :
code to be executed is indented and goes here
returning a value: a function that has an output returns a value and the value that is returned is preceded by the return command
LEARNING INTENTIONS:
After this tutorial you will be able to:
GLOSSARY:
function: function is a block of code that has a name and the entire block can be run just by calling the name of the function. Functions have the ability to take in information as well as to output information
parameters: these are inputs to a function
def functionName(parameter1, parameter2, parameter3) :
code to be executed is indented and goes here
returning a value: a function that has an output returns a value and the value that is returned is preceded by the return command
LEARNING INTENTIONS:
After this tutorial you will be able to:
LEARNING INTENTIONS:
GLOSSARY:
List (also called an array in other programming languages) is a tool that can be used to store multiple pieces of information at once. It can also be defined as a variable containing multiple other variables.
List index : is an integer which stands for the position of an item in the list so that 0 stands for the first item, 1 for the second, 2 for the third and so on
LEARNING INTENTIONS:
GLOSSARY:
Dictionary: In python a dictionary is a data structure consisting of paired pieces of information. This pairing is just like a word and a definition in a dictionary
LEARNING INTENTIONS:
In this tutorial you will do the following:
GLOSSARY:
Dictionary: In python a dictionary is a data structure consisting of paired pieces of information. This pairing is just like a word and a definition in a dictionary
While loop: a loop that depends on a condition. If the condition is true then the loop keeps running. The loop stops executing if the condition becomes false
LEARNING INTENTIONS:
In this tutorial we will learn to do the following:
LEARNING INTENTIONS:
Write a program that does the following:
LEARNING INTENTIONS:
Write a program that does the following:
GLOSSARY:
import random: This allows us to create random numbers by importing the module where the randint() function is located
random.randint(min,max) This function takes in two integer parameters and creates a number greater or equal to min and less or equal to max
While loop: a loop that depends on a condition. If the condition is true then the loop keeps running. The loop stops executing if the condition becomes false
LEARNING INTENTIONS:
Write a program that does the following
LEARNING INTENTIONS:
Write a program that does the following
1. Import a text file which contains all English words
2. Strip the words of all punctuation
3. Lowercase each word
4. create a list of all words in lower case
5. reverse each word and check if it remains the same
6. all words that remain the same to be printed out
palindrome a word, phrase, or sequence that reads the same backwards as forwards, e.g. madam or nurses run
punctuation For programming purposes these are all the characters that are not letters: !"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~’“”
punctuation needs to be cleared before we can process and analyse our text for palindromes
Becoming an awesome programmer is a bit like building a large tower of knowledge in that solid foundations are the key to your success. Completing this course will provide you with mastery over these foundations. Here is a quick summary of the journey that awaits you:
Curriculum
The course will focus on mastering the following concepts
Learning Process
The course incorporates principles known to help humans learn better, namely: multiple perspectives, revision, feedback and real world application. The following three step process will help you retain and master all the topics covered in this course:
Step 1: Demonstrate concept with both visual and text outputs: this is achieved by first writing a program with a text output and then writing another where the output is created visually using turtle.
Step 2: Test your understanding with 10 coding exercises: all of these are automatically marked using the python unittest module giving you instant valuable feedback.
Step 3: Apply your understanding to write useful and interesting programs: The core concepts you have learned will be put together into programs which do useful and interesting things like: