Tag Archives: python

Python – week 2

If you need help getting on to Python, go back to this post from last week.

Last week, year 5 programmed their first lines of code in Python. This week, we will learn how we can use repeat commands to make patterns.

Have a look at Step 4 of your handout – ASCII patterns, see if you can create your own pattern in Python. Please do not use a repeat number higher than 50 – last week this was causing Python to crash on some computers.

Extension – can you run a program which will calculate your age in the year 2025?

Python

This week, I am introducing Python to years 5 and 6. So far, we have used ‘block based’ programming (such as Scratch and Lightbot) where you use pre defined blocks to make things happen and drag and drop them into programs. Behind these blocks there is code, which actually makes everything happen.

Python is a programming language which is a great introduction in to coding. Over the next few weeks we will begin to explore the possibilities of Python.

To begin with, you need to open a Python programming window…

1. Click on spotlight search in the top right corner of the screen.
2. Type ‘terminal’ and open the terminal application
3. In the terminal app, type ‘idle’
4. A new window – Python Shell will open. Click in this window and from the file menu, choose ‘new file’

Now you can input your first line of Python code. Copy and paste this into the Python programming window:

print (“hello”)

To run this, first save what you have done into your own folder (desktop/your class/your name), then click on run module – what happens?

Can you modify this code to print something else? Save the code again.

Now look at page 4 of your handout – can you draw a dog in Python?

Code Club – Python!

download

Hello code club!

Today we are going to learn a new way of programming – Python. It can seem quite tricky at first, but if you stick with it you will get the hang of it. We’re going to start by doing some ASCII art. Make sure you read the instructions very carefully and ask me if you need any help.

Python ASCII Art

*Note – to open the terminal on a mac, click on the search tool and type ‘terminal’