In this ICS3U lesson you will be learning how to:
You are going to be writing computer programs using the Python Programming Language
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.
It is VERY STRONGLY recommended that you have a PC/MAC to complete this course, as there is software that needs to be installed that is not available on Tablet Devices.
I believe that passively acquiring information is NOT the best way to learn how to write computer programs. During portions of each lesson you will be required to complete short Interactive Learning Activities. In these activities you will be learning about small concepts and how certain pieces of code work. You will do this without having to leave the browser window and go and use different software. To accomplish this I have embedded what is known as a Python Trinket into the lessons.
For example, if you click on the toggle button you will be able to open a Python Editor and type and run the code snippets that are given to you in the activities.
Open the Toggle name “Python Editor” and type the following code into the Python Editor and Run the code to see what happens
name = input("Enter your name: ")
print("Hi",name)
You can switch back and forth between running the program (Arrow) and using the editor (Pencil)
Trinkets are good to run small pieces of code for teaching and learning purposes, but most programmers don’t use a web based python kernel to write their programs.
The most common way to write programs in python is to use an Integrated Development Environment (IDE). An IDE contains
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. (If you are an HWDB student on a school board machine running windows 10, you can install python and IDLE from the “Software Center” in the Start Menu. )
An alternative to the base Python installation, you can use a Conda Python Distribution. This has several advantages (most not relevant to this course) and is compatible with the SPYDER IDE. This is my primary python distribution and IDE that I always use. I used Spyder to make most of the videos in this course.
The Conda distribution is very popular in Industry and has a lot of utilities that are useful if you are interested in Data Science or Artificial Intelligence Programming.
There are two main distributions you could consider:
UPDATE: SEPTEMBER 2022
I’ve been having students encounter significant issues with getting Spyder to work with the anaconda distribution. The version of Spyder available on anaconda is Spyder v 5.1.5 There is a bug that will not allow you to use simple input statements (which are used in every question in this course) and there is no way to update Spyder in the anaconda environment to the newer version properly at the moment
So at this point, I cannot recommend the anaconda package be installed.
UPDATE: SEPTEMBER 2023 – Issue may have been fixed, currently looking into it
However, the miniconda version does have Spyder 5.2.2 which seems to fix the above issue.
Once you download the installer and install the distribution:
Below is a video about Spyder and the Anaconda Distribution. (I don’t have a video for the miniconda install, but Spyder is the same in both anyways)
Spyder has a newer version 5.3 and can be installed as a standalone app without conda from https://www.spyder-ide.org/, but that will create other issues when trying to install packages that we use in grade 12, so I don’t really recommend that either.
If you are ever stuck and not able to install an IDE on your device, then Replit “should” work on any device that has web access. I would only recommend this as a last resort for ICS3U. It has the advantage of making all your code available anywhere you have a web connection. There is no install. In my experience it isn’t as fast or user friendly and requires you to create an account to sign up. Please be mindful of what personal information you give to other websites. If you are thinking of going this route, you must let me know so I can inform your parents about any privacy concerns that could exist.
Pycharm is another very popular IDE that is used to create larger python projects. I just started using it for some personal projects, so there isn’t going to be a demo video right now, but you are free to download and see if you can figure out how it works.
Keep in mind if you are trying different IDE’s and installing different versions of Python, they will likely each install their own Python Interpreter on your machine.
That’s not really an issue, but if you are installing external packages, they might install to a different interpreter then expected. Shouldn’t be an issue with this course, but something to keep in mind if you notice it.
Whenever you save your python files in ICS3U from an IDE they will have the .py extension. That is what you will hand in when I’m grading your work. There is nothing special about these files, it is just your program code as you have written it in the editor.
They will not however open in your IDE like regular Word or pdf files by “double clicking” them in your file manager. If you do that, then your OS will likely try to actually just run the program using the python interpreter. If you want to open and edit them, then that must be done within the IDE
Note to HWDSB Students…. Trying to send .py files in outlook email in our system likely won’t work as our security system treats them as a dangerous file.
Task #1 – Install the base version of python and the IDLE IDE
name = input("Enter your name: ")
print("Hi",name)
Task #2- OPTIONAL – Try out a different IDE
Option – Install the Conda version of python and the Spyder IDE