The importance of comments in Python

Comments are sections of code that are ignored by python when your code runs. But they are still really useful for making your code easier to read, understand, debug and improve.

This tutorial explains 5 ways that comments can help you as you learn to code in python. It guides you through what a comment is and how to use them effectively in your own programs.

Comments in Python
Parameters in python: Adapt and reuse sections of your code

Contents:

Page 1: Intro

Page 2: The theory: learn what you need to know as fast as possible.

Page 3: Try it: try out and adapt some working python code snippets.

Page 4: Debug it: Learn how to find and fix common mistakes.

Page 5: Extend it: Choose a project idea to use your newfound python skills.

Continue ReadingThe importance of comments in Python

GCSE Computer Science resource updated to include OCR Exam Reference Language

To help students grow in confidence understanding and writing code (in pseudocode and a variety of high level programming languages like python, I’ve just updated a resource that contains and explains code snippets for all of the main programming building blocks that students need for GCSE. The resource now includes code examples for OCR Exam Reference Language alongside Python, VB.NET and C#.

Exam Reference Language
Quick Reference guide allows students to compare and understand code in Python, VB.NET, C# and OCR Exam Reference Language

Different exam boards offer slightly different versions of GCSE Computer Science, each with their own different styles of assessment and each with slightly different learning objectives to cover.

The most popular GCSE in Computer Science (in terms of number of students entered) is the OCR J277 course where students sit two paper based exams. Algorithms and program code in those exams will be written in an Exam Reference Language which is detailed in the specification. Students are able to write code in any high level programming language (like python) or in the same Exam Reference Language.

My students study the Pearson Edexcel GCSE in Computer Science, partly because it offers students a chance to swap one of the paper based exams for an on-screen practical programming exam where students read, debug, rearrange and write actual python code rather than having to deal with abstract pseudocode style algorithms on paper.

The QuickRef resource allows you to search for a programming skill (such as procedures or functions) and see how that can be achieved with Python, VB.NET, C# and Pseudocode / OCR Exam Reference Language.

If you spot anything missing or incorrect, please do leave a comment below.

All the best

Continue ReadingGCSE Computer Science resource updated to include OCR Exam Reference Language

19: Optimisation in python

Python is a very powerful and flexible programming language which lets you write programs quickly, but code written in python doesn’t always run as quickly as it might in other languages (like C or C++)

This tutorial guides you through why it can be really helpful to optimise your code and how to do that.

Make your code more efficient
Optimisation in python: Make your code more efficient

Contents:

Page 1: Intro

Page 2: The theory: learn what you need to know as fast as possible.

Page 3: Try it: try out and adapt some working python code snippets.

Page 4: Debug it: Learn how to find and fix common mistakes.

Page 5: Extend it: Choose a project idea to use your newfound python skills.

Continue Reading19: Optimisation in python