How to run example code
|
Throughout the course you will see sections of code with a 'Run the following code' instruction above it, like this: |
|
Run the following code
When you see a 'Run the following code' section like this, you need to copy (click on the blue icon to the right of the code), paste and run the code yourself to see what the output is. You are welcome to experiment by making changes to the code and seeing the result. |
|
To create a Python file in Visual Studio Code (or your preferred code editor), open a new file and save the file with .py as the file extension. You may need to change your settings so that you can see file name extensions:
In Windows 11:
Remember to name your files logically (e.g. softdev_week2.py) It's a good idea to keep a file or collection of files containing the example code, even if you are pasting it directly to a code editor to run it, so that you can easily refer back to the code later in the course for the SAC and SAT assessments. Think about how you are naming and organising your files and folders. Give your files and folders meaningful names so that you can easily tell what they contain. You may want to create a separate folder for each week of the course. |