ICS4U - Unit 1 - Fundamental Concepts and Recursion
Unit 2 - Working With Data
Unit 3 - Searching and Sorting Algorithms
Unit 4 - Object Oriented Programming
Unit 5 - Topics in Computer Science
Unit 6 - Introduction to Pygame
Unit 7 - Project Management
Unit 8 - Culminating Activity

ICS4U – Getting Started With Python

ICS4U Learning Goals

In this ICS4U lesson you will be learning how to:

  • Download and install Python to your computer
  • Use an Integrated Development Environment to write a python program
  • Install 3rd party python packages to your device

Python Programming Language

ICS3U ICS4U Python Image

The programming language of choice in this course is Python .  I am aware that some of you will have programmed in different languages in Grade 11.  There really isn’t much i can do to change that, but its the skills from grade 11 are what were important.  So if you were a good coder in grade 11, it shouldn’t be too much of a chore to pick up a new language pretty quickly, and you will need to put in some extra effort right away to get caught up with the essentials of Python.  If you have any interest in computer science as a future career, working with different languages is essential.

Python is an Interpreted language and thus needs the python interpreter to run the code.  We can run that interpreter on our machines or through a server on the web.  

  • A proper computer PC / Mac is HIGHLY RECOMMENDED in this course.
If you don’t have a compatible device, I can recommend some CLOUD BASED PYTHON INTERPRETERS that will run with any internet connections.  You will be able to meet all the curriculum expectations and complete the course, but it will require a modified approach to some of the activities.  I can provide more details on that if necessary.  Most issues will occur with students using a school device from a different school board other than HWDSB or a Chromebook.  
 

The first thing you will need to do is setup an IDE (Integrated Development Environment) o your computer to run Python.

  • Any Python v3.XX is appropriate. (Definitely do NOT use v2.XX as there are significant differences)
Note:  Python files have the extension .py  If you are trying to send these .py files over the HWDSB email system, the school board will flag them as a dangerous file and remove the attachment.  The same is not true for files submitted on Brightspace (THE HUB), they are perfectly fine there.  
 

Integrated Development Environments

Option #1 - IDLE

This is the most straightforward and lightweight way to create and run python programs on your computer.  It comes built in when you download python from python.org. 

On your personal device, you should visit python.org and download python version of your choice and install it

If you are using an HWDSB device (school PC or student issued laptop) you can access the download via the software center.  (Search Software Center on Windows)

IDLE Demo

  • Watch the video below for a demo on how to write a program using IDLE

Installing additional Packages

Later on in the course you will be using a package for some more interesting projects.  More specifically I use Pygame for the project management portion of the curriculum 

If you are installing from a HWDSB device, you don’t need to do anything else, Pygame will come preinstalled with that download.  

If you are using your own personal device and have downloaded python from python.org, you will need to manually install pygame.  

To install the pygame package and be able to use them with IDLE, we can use a package management system called PIP.  To access PIP you need to open a Terminal Window on your computer.  

  • Windows -> Search for “cmd” in the Windows Search Bar and it will open up a terminal window.
  • Mac -> Press the “Command” button and the space bar simultaneously then search for “Terminal” 

To actually install the packages, you need to just type the following in your terminal window

  • pip install packageName
  • Note: on Windows you will likely need to type
    • py -m pip install packageName
    • So for pygame you would type py -m pip install pygame

Other Options - Pycharm and VSCode

These are other IDE’s you can use, but I’m not trouble shooting them in this course.  Feel free to try them out, but you are on your own to figure out how to get them setup and working.  

ICS4U Activity

Install Python and Communicate with your teacher the results

  • Download and install python on your device.
    • If you are on a personal device or a non HWDSB device, Install pygame using PIP
  • Create a program called “demo.py” and enter the code below.  
  • Get the program to run on your device
  • If the code runs without errors then you are all good
  • If you can’t install python for any reason or because of the device you are using, your teacher needs to know immediately
				
					import pygame

name = input("Enter your name: ")
print("Hi",name)

				
			

ICS4U Activity

Go to the discussion forum on the HUB 

  • Send your teacher a message on the HUB (not email)  indicating if you have successfully installed python and the code above runs fine.
  • Let him know if you are having any issues and require information on using a CLOUD Based python interpreter. 

Return to ICS4U Main Page