1 of 109

Welcome to GPN!

Perth Term 1 2026

Connect to UWA WiFI

1. Select UnifiGuest wireless network�2. Enter the username and password

Username: perthgpn

Password: Gt88.mk?

3. Accept the Terms of Use.�4. Click the "Log in" button.

Connect to UWA WiFi

2 of 109

Welcome to GPN

3 of 109

Thank you to our Sponsors!

Platinum Sponsor:

Gold Sponsor:

4 of 109

Who are the tutors?

5 of 109

Log on

Log on and jump on the GPN website

girlsprogramming.network/workshop

Click on your node location

Click on your room.

From this page you can see:

  • These slides (to take a look back or go on ahead).
  • A link to your workbook in EdStem
  • Other helpful bits to use through the day!

6 of 109

Tell us you’re here!

Click on the

Start of Day Survey

and fill it in now!

7 of 109

Today’s project!

Markov Chains!

8 of 109

What is a Markov Chain?

A Markov chain is a simple Artificial Intelligence!

Let’s play a game with some cups to help explain it

9 of 109

Let’s play the cups game!

Let’s generate some text in the style of

Green Eggs & Ham by Dr Seuss

Do you like green eggs and ham?

I do not like them, Sam-I-am.

I do not like green eggs and ham.

Would you like them here or there?

I would not like them here or there.

I would not like them anywhere.

10 of 109

Let’s play the cups game!

  • Each cup is labelled with a word from Green Eggs and Ham

  • Each cup contains the words that follow the "label" word in Green Eggs and Ham

We’re going to write some text by randomly choosing a next word based on the word before it

11 of 109

Let’s play the cups game!

Read the outside of your cup!

If someone shouts the word on the outside of your cup:

  1. Pick a piece of paper from inside your cup
  2. Shout out the word on the piece of paper
  3. Put the piece of paper back in your cup

A tutor will write the words called out on the board

12 of 109

Today we’ll be making Markov Chains!

Markov chains are exactly what we just did with the cups!

Today we’ll make the computer do it to make some crazy stories!!

Here’s one we made from some Shakespeare!�

Imagine if you used one of these to do your homework!!

doth stay! All days when I compare thee to unseeing eyes be blessed made By chance, or eyes can see, For all the top of happy show thee in dark directed. Then thou, whose shadow shadows doth stay! All days when I compare thee in your self in inward worth nor outward fair, Can make bright, How would thy shade Through heavy sleep on the eye of life repair, Which this, Time's pencil, or my pupil pen, Neither in the living day, When in eternal lines of that fair from fair thou grow'st, So should the lines to a summer's day?

13 of 109

Introduction to Edstem

14 of 109

Log on

Click on your Workbook link to take you into EdStem

15 of 109

Signing up to Edstem

Log in if you already have a an “Edstem” account from a past GPN

If you haven’t got an account, let’s make one:

  1. Type in your Full Name
  2. Type in your personal email
  3. Click Create Account
  4. Go to your email and verify your new account
  5. Create a password

Click Join Course

The name of your course will be at the top :

If you don’t have access to your email account, ask a tutor for a GPN Edstem login

16 of 109

Getting to the lessons

  1. Once you are in the course, you’ll be taken to a discussion page.
  2. Click the button for the lessons page (top right - looks like a book)

17 of 109

Inside a Chapter

Inside a Chapter there are two main types of pages:

  • Lessons where you will do your coding.
    • They have this icon:

  • Checkpoints

Each chapter has a checkpoint to complete to move to the next chapter. Make sure you scroll down to see all the questions in a checkpoint.

There may also be Bonus Lessons to try if you want to or if you are waiting for the next lecture

18 of 109

How to do the work

In each Lesson there is:

  1. A section on the left with instructions
  2. A section on the right for your code

You will need to copy your code from the last lesson, then follow the instructions to change your code

There are also Hints and Code Blocks to help you

19 of 109

Hints

Sometimes in a lesson, there’s some code we want you to do that might be a bit tricky, to help you out we’ve added some hints. They look like this:

If you press the blue run button it will show you what that code does, you can even change the code to see if/how it changes.

These are just hints make sure you’re not copying the hint into your code as it will likely end up breaking. They are just to show you the kinds of things you can do.

20 of 109

Running your code…

Click in the bottom right hand corner

Your code will run and any output will display in the Console

Don’t worry if you forget. Tutors

will help!

21 of 109

Some shortcuts…

There are a couple things you can do to make copying your code from one page to another easier.

  1. Ctrl + A

  1. Ctrl + C

  1. Ctrl + V

Pressing these keys together will select all the text on a page

Pressing these keys together will copy anything that’s selected

Pressing these keys together will paste anything you’ve copied

On Macs use Command (⌘) instead of Ctrl

22 of 109

Project time!

You now know all about the EdStem!

You should now sign up and join our EdStem class.

Remember the tutors will be around to help!

23 of 109

Intro to Programming

24 of 109

What is programming?

It’s giving computers a set of instructions!

Programming is not a bunch of crazy numbers!

25 of 109

A Special Language

A language to talk to dogs!

Programming is a language to talk to computers

26 of 109

People are smart! Computers are dumb!

Programming is like a recipe!

Computers do EXACTLY what you say, every time.�

Which is great if you give them a good recipe!

27 of 109

People are smart! Computers are dumb!

But if you get it out of order….��A computer wouldn’t know this recipe was wrong!��

28 of 109

People are smart! Computers are dumb!

Computers are bad at filling in the gaps!��A computer wouldn’t know something was missing, it would just freak out!

29 of 109

Everyone/thing has strengths!

  • Does exactly what you tell it
  • Does it the same every time
  • Doesn’t need to sleep!
  • Will work for hours on end!
  • Get smarter when you tell them how
  • Understand instructions despite:
    • Spelling mistakes
    • Typos
    • Confusing parts
  • Solve problems
  • Tell computers what to do
  • Get smarter every day

30 of 109

Intro to Python

Let’s get coding!

31 of 109

Let’s make a mistake!

Click on Chapter 1 ‘Welcome message’

The first lesson ‘1.1 Print a message’ will open. It looks like this

32 of 109

Let’s make a mistake!

Type by button mashing the keyboard here - type anything you want

Click Run here to run your code!

Did you get a big ugly error message?

33 of 109

Mistakes are great!

Good work you made an error!

  • Programmers make A LOT of errors!
  • Errors give us hints to find mistakes
  • Run your code often to get the hints!!
  • Mistakes won’t break computers!

AttributeError: 'NoneType' object has no attribute 'foo'

TypeError: Can't convert 'int' object to str implicitly

ImportError: No module named humour

KeyError: ‘Hairy Potter’

SyntaxError: Invalid Syntax

34 of 109

We can learn from our mistakes!

Error messages help us fix our mistakes!

We read error messages from bottom to top

Traceback (most recent call last):

File "C:/Users/Madeleine/Desktop/tmp.py", line 9, in <module>

print("I have " + 5 + " apples")

TypeError: can only concatenate str (not "int") to str

35 of 109

We can learn from our mistakes!

Error messages help us fix our mistakes!

We read error messages from bottom to top

Traceback (most recent call last):

File "C:/Users/Madeleine/Desktop/tmp.py", line 9, in <module>

print("I have " + 5 + " apples")

TypeError: can only concatenate str (not "int") to str

1. What went wrong

36 of 109

We can learn from our mistakes!

Error messages help us fix our mistakes!

We read error messages from bottom to top

Traceback (most recent call last):

File "C:/Users/Madeleine/Desktop/tmp.py", line 9, in <module>

print("I have " + 5 + " apples")

TypeError: can only concatenate str (not "int") to str

1. What went wrong

2. What code didn’t work

37 of 109

We can learn from our mistakes!

Error messages help us fix our mistakes!

We read error messages from bottom to top

Traceback (most recent call last):

File "C:/Users/Madeleine/Desktop/tmp.py", line 9, in <module>

print("I have " + 5 + " apples")

TypeError: can only concatenate str (not "int") to str

1. What went wrong

3. Where that code is

2. What code didn’t work

38 of 109

Write some code!!

This is the first bit of code we will do. What do you think it does?��print('hello world')

39 of 109

Write some code!!

This is the first bit of code we will do. What do you think it does?��print('hello world')

It prints the words “hello world” onto the screen!

40 of 109

Write some code!!

  1. Type the following into the code window (make sure you include the quotes (“) at the start and end)
  2. Run the code by clicking Run �

print(“hello world”)

�Did it print the text:

hello world

???

41 of 109

Tell me more!

We can print things in lots of different ways in python!

>>> print("Hello world!")

Hello world!

>>> print("Hello", "world!")

Hello world!

>>> print("Hello", "world", end="!")

Hello world!

Note that this last one will not have a new line after it!

42 of 109

Tell me more!

We can print things in lots of different ways in python!

>>> print("Hello world!")

Hello world!

>>> print("Hello", "world!")

Hello world!

>>> print("Hello", "world", end="!")

Hello world!

Note that this last one will not have a new line after it!

43 of 109

Tell me more!

We can print things in lots of different ways in python!

>>> print("Hello world!")

Hello world!

>>> print("Hello", "world!")

Hello world!

>>> print("Hello", "world", end="!")

Hello world!

Using a comma (,) puts a space between the words

44 of 109

Tell me more!

We can print things in lots of different ways in python!

>>> print("Hello world!")

Hello world!

>>> print("Hello", "world!")

Hello world!

>>> print("Hello", "world", end="!")

Hello world!

Note that this last one will not have a new line after it!

45 of 109

Variables

Variables are useful for storing things that change

(i.e. things that "vary" - hence the word "variable")

You can think of it like putting information in a box and giving it a label

friend

46 of 109

Variables

When coding, we can make a variable called friend and set it to a value like this

friend = “Alex”

friend

Alex

47 of 109

Variables

Instead of writing the word “Alex”, we can write friend (the variable’s name).

The computer will substitute the current value of friend.

It’s like we’re getting the value out of the box!

print(friend)

friend

Alex

48 of 109

Variables

Instead of writing the word “Alex”, we can write friend (the variable’s name).

The computer will substitute the current value of friend.

It’s like we’re getting the value out of the box!

print(friend)

friend

Alex

Alex

49 of 109

Reusing variables

We can replace values in variables:

animal = "dog"

print("My favourite animal is a " + animal)

animal = "cat"

print("My favourite animal is a " + animal)

animal = animal + "dog"

print("My favourite animal is a " + animal)

What will this output?

50 of 109

Reusing variables

We can replace values in variables:

animal = "dog"

print("My favourite animal is a " + animal)

animal = "cat"

print("My favourite animal is a " + animal)

animal = animal + "dog"

print("My favourite animal is a " + animal)

My favourite animal is a dog

My favourite animal is a cat

My favourite animal is a catdog

What will this output?

51 of 109

Asking a question!

It’s more fun when we get to interact with the computer! ��Let’s get the computer to ask us a question!

my_name = input('What is your name? ')

print('Hello ' + my_name)

  1. Computer prints ‘What is your name?’
  2. Computer waits for you to type in your name
  3. Computer prints ‘Hello Maddie’

This is what happens …

What is your name? Maddie

Hello Maddie

52 of 109

Breaking it down

my_name = input('What is your name? ')

print('Hello ' + my_name)

What do you think happens?

What is your name? Maddie

Hello Maddie

Store the answer in the variable my_name

53 of 109

Breaking it down

my_name = input('What is your name? ')

print('Hello ' + my_name)

What do you think happens?

What is your name? Maddie

Hello Maddie

Store the answer in the variable my_name

Writing input tells the computer to wait for a response

54 of 109

Breaking it down

my_name = input('What is your name? ')

print('Hello ' + my_name)

What do you think happens?

What is your name? Maddie

Hello Maddie

Store the answer in the variable my_name

Writing input tells the computer to wait for a response

This is the question you want printed to the screen

55 of 109

Breaking it down

my_name = input('What is your name? ')

print('Hello ' + my_name)

What do you think happens?

What is your name? Maddie

Hello Maddie

Store the answer in the variable my_name

Writing input tells the computer to wait for a response

This is the question you want printed to the screen

We can use the answer the user wrote that we then stored later!

56 of 109

Breaking it down

my_name = input('What is your name? ')

print('Hello ' + my_name)

SPACE 🙂

What is your name? Maddie

Hello Maddie

Big Tip : Put a space at the end of the question so it won’t be squished together with your answer - it looks nicer!

NO SPACE 🙁

What is your name?Maddie

Hello Maddie

57 of 109

Adding a comment!

Sometimes we want to write things in code that the computer doesn’t look at! We use comments for that! �Use comments to write a note or explanation of our code

Comments make code easier for humans to understand

We can make code into a comment if we don’t want it to run (but don’t want to delete it!)

# This code was written by Sheree

# print(“Goodbye world!”)

58 of 109

Project time!

You now know all about printing, variables and input!

Let’s put what we learnt into our project

Try to do Lessons 1 & 2

Don't forget to copy your code when you move to a new Lesson!

The tutors will be around to help!

59 of 109

If Statements and Lists

60 of 109

Conditions!

Conditions let us make decisions.

First we test if the condition is met!

Then maybe we’ll do the thing

If it’s raining take an umbrella

Yep it’s raining

…... take an umbrella

61 of 109

Booleans (True and False)

Computers store whether a condition is met in the form of �True and False

To figure out if something is True or False we do a comparison

"Dog" == "dog"

"D" in "Dog"

"Q" not in "Cat"

5 < 10

3 + 2 == 5

5 != 5

62 of 109

Booleans (True and False)

Computers store whether a condition is met in the form of �True and False

To figure out if something is True or False we do a comparison

"Dog" == "dog"

"D" in "Dog"

"Q" not in "Cat"

5 < 10

3 + 2 == 5

5 != 5

True

63 of 109

Booleans (True and False)

Computers store whether a condition is met in the form of �True and False

To figure out if something is True or False we do a comparison

"Dog" == "dog"

"D" in "Dog"

"Q" not in "Cat"

5 < 10

3 + 2 == 5

5 != 5

True

True

64 of 109

Booleans (True and False)

Computers store whether a condition is met in the form of �True and False

To figure out if something is True or False we do a comparison

"Dog" == "dog"

"D" in "Dog"

"Q" not in "Cat"

5 < 10

3 + 2 == 5

5 != 5

True

True

False

65 of 109

Booleans (True and False)

Computers store whether a condition is met in the form of �True and False

To figure out if something is True or False we do a comparison

"Dog" == "dog"

"D" in "Dog"

"Q" not in "Cat"

5 < 10

3 + 2 == 5

5 != 5

True

True

False

False

66 of 109

Booleans (True and False)

Computers store whether a condition is met in the form of �True and False

To figure out if something is True or False we do a comparison

"Dog" == "dog"

"D" in "Dog"

"Q" not in "Cat"

5 < 10

3 + 2 == 5

5 != 5

True

True

False

False

True

67 of 109

Booleans (True and False)

Computers store whether a condition is met in the form of �True and False

To figure out if something is True or False we do a comparison

"Dog" == "dog"

"D" in "Dog"

"Q" not in "Cat"

5 < 10

3 + 2 == 5

5 != 5

True

True

False

False

True

True

68 of 109

Conditions

So to know whether to do something, they find out if it’s True!

fave_num = 5

if fave_num < 10:

print("that’s a small number")

69 of 109

Conditions

So to know whether to do something, they find out if it’s True!

fave_num = 5

if fave_num < 10:

print("that’s a small number")

That's the condition!

70 of 109

Conditions

So to know whether to do something, they find out if it’s True!

fave_num = 5

if fave_num < 10:

print("that’s a small number")

Is it True that fave_num is less than 10?

  • Well, fave_num is 5
  • And it’s True that 5 is less than 10
  • So it is True!

That's the condition!

71 of 109

Conditions

So to know whether to do something, they find out if it’s True!

fave_num = 5

if fave_num < 10:

print("that’s a small number")

True

Is it True that fave_num is less than 10?

  • Well, fave_num is 5
  • And it’s True that 5 is less than 10
  • So it is True!

Put in the answer to the question

72 of 109

Conditions

So to know whether to do something, they find out if it’s True!

fave_num = 5

if fave_num < 10:

print("that’s a small number")

True

What do you think happens?>>>

73 of 109

Conditions

So to know whether to do something, they find out if it’s True!

fave_num = 5

if fave_num < 10:

print("that’s a small number")

True

What do you think happens?>>> that’s a small number

74 of 109

Conditions

How about a different number???

fave_num = 9000

if fave_num < 10:

print("that’s a small number")

75 of 109

Conditions

Find out if it’s True!

fave_num = 9000

if fave_num < 10:

print("that’s a small number")

What should this say?

76 of 109

Conditions

Find out if it’s True!

fave_num = 9000

if fave_num < 10:

print("that’s a small number")

Is it True that fave_num is less than 10?

  • Well, fave_num is 9000
  • And it’s not True that 9000 is less than 10
  • So it is False!

What should this say?

77 of 109

Conditions

Find out if it’s True!

fave_num = 9000

if fave_num < 10:

print("that’s a small number")

Is it True that fave_num is less than 10?

  • Well, fave_num is 9000
  • And it’s not True that 9000 is less than 10
  • So it is False!

What should this say?

False

78 of 109

Conditions

Find out if it’s True!

fave_num = 9000

if fave_num < 10:

print("that’s a small number")

False

What do you think happens?>>>

79 of 109

Conditions

Find out if it’s True!

fave_num = 9000

if fave_num < 10:

print("that’s a small number")

False

What do you think happens?>>>

Nothing!

80 of 109

If statements

fave_num = 5

if fave_num < 10:

print("that’s a small number")

This line …

… controls this line

81 of 109

If statements

fave_num = 5

if fave_num < 10:

print("that’s a small number")

print("and I like that")

print("A LOT!!")

This line …

… controls anything below it that is indented like this!

Actually …..

82 of 109

If statements

fave_num = 5

if fave_num < 10:

print("that’s a small number")

print("and I like that")

print("A LOT!!")

What do you think happens?>>>

83 of 109

If statements

fave_num = 5

if fave_num < 10:

print("that’s a small number")

print("and I like that")

print("A LOT!!")

>>> that’s a small number�>>> and I like that�>>> A LOT!!

84 of 109

If statements

word = "GPN"

if word == "GPN":

print("GPN is awesome!")

What happens?

85 of 109

If statements

word = "GPN"

if word == "GPN":

print("GPN is awesome!")

What happens?

>>> GPN is awesome!

:

At end of each if line to say you have finished writing your condition

==

When testing for equals in your condition

Remember …

86 of 109

Lists

But we don’t store it on lots of little pieces of paper!

We put it in one big shopping list!

��

Bread

Ice Cream

Chocolate

Pizza

  • Bread
  • Chocolate
  • Ice Cream
  • Pizza

When we go shopping, we write down what we want to buy!

87 of 109

Lists

It would be annoying to store it separately when we code too

>>> shopping_item1 = "Bread"

>>> shopping_item2 = "Chocolate"

>>> shopping_item3 = "Ice Cream"

>>> shopping_item4 = "Pizza"

So much repetition!�

Instead we use a python list!

shopping_list = ["Bread", "Chocolate", "Ice Cream", "Pizza"]

88 of 109

List anatomy

shopping_list = ["Bread", "Chocolate", "Ice Cream", "Pizza"]

Stored in the variable shopping_list

89 of 109

List anatomy

shopping_list = ["Bread", "Chocolate", "Ice Cream", "Pizza"]

Made up of different items (these are strings)

Stored in the variable shopping_list

90 of 109

List anatomy

shopping_list = ["Bread", "Chocolate", "Ice Cream", "Pizza"]

Made up of different items (these are strings)

Stored in the variable shopping_list

The items are separated by commas

91 of 109

List anatomy

shopping_list = ["Bread", "Chocolate", "Ice Cream", "Pizza"]

Has square brackets either side

Made up of different items (these are strings)

Stored in the variable shopping_list

The items are separated by commas

92 of 109

Lists

You can print a list

shopping_list = ["Bread", "Chocolate", "Ice Cream", "Pizza"]

print(shopping_list)

>>> ["Bread", "Chocolate", "Ice Cream", "Pizza"]

93 of 109

Project Time!

You now know all about if and lists!

See if you can do Lesson 3

The tutors will be around to help!

94 of 109

Random!

95 of 109

That’s so random!

There’s lots of things in life that are up to chance or random!

Python lets us import common bits of code people use! We’re going to use the random module!

We want the computer to be random sometimes!

96 of 109

Using the random module

Let’s choose something randomly from a list!

This is like drawing something out of a hat in a raffle!

Try this!

  1. Import the random module!��
  2. Copy the shopping list into IDLE���
  3. Choose randomly! Try it a few times!

>>> import random

>>> shopping_list = ["eggs", "bread", "apples", "milk"]

>>> random.choice(shopping_list)

97 of 109

Using the random module

You can also assign your random choice to a variable

>>> import random

>>> shopping_list = ["eggs", "bread", "apples", "milk"]

>>> random_food = random.choice(shopping_list)

>>> print(random_food)

98 of 109

Using the random module

Let’s choose something randomly from a list!

This is like drawing something out of a hat in a raffle!

We use random.choice to randomly select something from a list

Each time we run this we would probably get a different answer

eggs OR bread OR apples OR milk

import random

shopping_list = ["eggs", "bread", "apples", "milk"]

random.choice(shopping_list)

99 of 109

Project Time!

Raaaaaaaaaandom! Can you handle that?

Let’s try use it in our project!

Try to do Lesson 4�� The tutors will be around to help!

100 of 109

Using the random module

You can also assign your random choice to a variable and then use that variable in your code

import random

shopping_list = ["eggs", "bread", "apples", "milk"]

random_food = random.choice(shopping_list)

print(random_food)

The variable random_food contains the random choice that was made from the list

101 of 109

102 of 109

103 of 109

104 of 109

105 of 109

106 of 109

107 of 109

108 of 109

109 of 109

How did you go?

Click on the

End of Day Survey

and fill it in now!

girlsprogramming.network/workshop

Click on your node location