Home Year 7 Year 8 Year 9 GCSE A-Level

MR MAKEPEACE.NET

Python

Scheme of work (word document)

Codecadmy Python course (homework is to get to lesson 20 by the end of this term but if you do more you will be a better programmer)

Thenewboston video tutorials  (good if you need a bit of extra help understanding a concept)

Lesson 1

Introduction to the course – year 9 / AQA spec

Why being able to code is great / important

Introduction to Python / similarities and differences with small basic

Ways in which to learn Python if you are stuck or unsure of something

Codecadmey Homework for half term


Lesson 2

Open python IDLE shell do a few little maths and variable things within the shell

Open a new python file

Input and output a variable

Camel case for variables

Functions – what they are, parameters and importing modules / libraries

Simple program to enter name and some numbers and output numbers added together

Strings – ‘he/’s the man’ single quotes and adding strings and concatenation

Data types

String to int and int to string

Lists  - making and selecting










Strings as lists


Lesson 3

If functions

Operators

Indentation

Elif









Nested if

Random numbers

Own program (exam grades, best tv show, love cal, magic 8, baggage handling cost, heads or tails)


Lesson 4

Loops

For x in range(0, 100)










Own program (Print 1 – 100, in 2, 8-20 in 3s, time tables, )

While


Lesson 5 and 6

Using loops and ifs to create some text based programs

Only print positive numbers in a list

Only print names beginning with A from list

Text File handling - get list from text file cities, save result in text file

comments - self assessment submission on itslearning.com



Lesson 7 and 8

In pairs - with little help from teacher

Create a double or nothing program  

Extend to include a score board


Lesson 9 and 10

Higher or lower program

Maze  game -


import time


print("You are trying to find your way through a maze to the centre where ")

print("there is a pot of gold!")

print("What you don't know is that this is a dangerous maze with traps and hazards.")

print()

print("Starting maze game ...")

print()

print("You enter the maze...")

time.sleep(2) # time.sleep is just used to build up the suspense!

print("You reach a opening in the wall and go through it...")

print()

time.sleep(2)

print("You can go left (L) or right (R)")

answer = input("Make your choice ... ")

print("You chose",answer,"... what will happen? ...")

time.sleep(2)

print("You turn the corner...")

time.sleep(2)

print("You walk forward a few steps...")

time.sleep(2)

if answer == "R":

    print("...and fall down a trap door and are never seen again....")

else:

    print("...and see a beautiful grassy path lined with trees with a pot of gold at the end!")



Maze using functions


Christmas python


Tree

# take height of tree in lines and store in a variable


# loop the height of tree times


    # work out the amount of space to have a the front of the printed line

    

    # work out the number of stars to have after the space

    

    # print the space and then the stars on a line

    

    



12 days of Christmas

# list of all the presents (verses)

verses = ["and a Partridge in a Pear Tree" ,"2 Turtle Doves", "3 French Hens","4 Calling Birds","5 Golden Rings","6 Geese a Laying","7 Swans a Swimming","8 Maids a Milking","9 Ladies Dancing","10 Lords a Leaping","11 Pipers Piping","12 Drummers Drumming"]

# list of the days

days = ["first", "second", "third", "fourth", "fifth", "sixth", "seventh", "eighth", "ninth", "tenth", "eleventh", "twelfth"]

#reverse the list of verses



#loop twelve times


    #print " on the ???? days of xmas my true love... where the ??? is an element from the days list


    # add a loop inside the loop for the verses

    

        # work out which verse to print out (this loop minus the other loop cycle)


        # print out that verse

        

    #print a blank line



# if you get it working make the first line of the first verse not contain the word "and" at the start