The Power of Python

Learn a bit about what Python is, what it is used for in the real world, and what we can gain from learning it. Discover where your programming skills could take you in the future if you continue to practice Python programming.

What is Python?

Python is a programming language. That is, you write code using the Python language, and then you "run" that code as a Python program.

Python is what we call an "interpreted language". Programs written in interpreted languages are able to be run immediately, using the exact code that you have written.

The opposite of an interpreted language is a "compiled language". Compiled languages have a step between your code and the final runnable program. This step is called "compiling". When you compile your code, it is run through a separate "compiler program" to change your code into a format which your computer can run.

Because Python is an interpreted language, it is very easy for us to just write our code and then run it, without worrying about an extra step in between.

Activities

Presentation Slides If you haven't yet been through the Power of Python presentation slides, you can have a flick through them here.

  • ?
  • ?

Questions

  1. Who invented Python, and in which year?
  2. What is a programming language?
  3. How would you explain the difference between an interpreted language and a compiled language?

Language Characteristics

Python is a very flexible language, which means it can be written in many different ways and can be run in many different places for many different purposes.

Flexibility is great, because it means you can use your Python skills to solve a wide range of problems. However, it can also be confusing for beginners to know where to start!

Python is well known for having "highly readable syntax". This means that the programming language uses quite a lot of plain English words, and also doesn't use as many crazy brackets and dots as other languages. There are still lots of language rules to learn in Python, but just not as many as some other programming languages!

Thanks to its flexibility and its highly readable syntax, Python is often chosen as a friendly starting place for beginner programmers.

Activities

  • ?
  • ?
  • ?

Questions

  • What does the word "syntax" mean?
  • Why is Python considered to be a good programming language for beginners?
  • ?

Python Versions

Python has many versions. There are programmers always working on Python and making it better, so every now and then they release a new version with all their changes.

When you install Python, you choose which version to install. For this course we will be using Python 3. Once you install a version of Python, you will always have that version until you choose to upgrade to a new version. Upgrading is done by downloading and installing a new version from the Python website.

Python 3 is the first version of Python designed to be "backwards compatible". This means that if you have Python 3 installed on your computer and you try to run something written using Python 2 code, it should probably work okay.

If you do come across a problem when trying to run code from someone else, double check which version of Python it was written for - that may be the problem!

You can always switch between Python 2 and Python 3 if needed, but hopefully you will be able to run most of the code you need using just Python 3.

Activities

  • ?
  • ?
  • ?

Questions

  • What is the version number of the most recent Python release, and how did you find it?
  • What does it mean if a programming language is "backwards compatible"?
  • Who is in charge of improving the Python language and releasing new versions?

Writing Python Code

Writing Python code is just as simple as writing a plain text document. In fact, if you had a file called myprogram.txt with some Python code in it, and you changed the file name to myprogram.py - that's a Python program!

The only difference between a Python file and a plain text file is that a Python file has the extension ".py". If you ever see a file called something.py, it's almost certainly part of a Python program!

Python programs can be made up of just one file, or can be made of many files all working together. When a program is made up of many files, there is still one main file which acts as the start or launching point for the program.

We will have a go at making our own Python code and files later in the course, but for now it is enough to understand that they are really just plain text files with fancy content and a special file name.

Activities

  • ?
  • ?
  • ?

Questions

  • Could you use Microsoft Word to write Python code? Why or why not?
  • What is the file name extension used for Python program files?
  • How many files are needed to make a working Python program?

Application Types

Python programs can run on many different platforms and devices. A "platform" is an environment where a program can be run. For example, Windows and OSX are both platforms where you can run Python programs.

The web is also a platform - Python can be used to run websites. Arduino is a hardware platform, where we can use Python to interact with physical elements like lights and motors. Android is a platform, and Apple's iOS for mobile is a platform, but Python does not run on either of them.

As well as being able to run on many platforms, Python can be used to create many types of program. The most basic Python program could be text-only and could run in a command line window. More complex Python programs could be used to run full websites with many web pages, or could even be graphical interactive games which run in a normal application window on your computer.

Activities

  • ?
  • ?
  • ?

Questions

  • ?
  • ?
  • ?

Benefits of Learning

By learning Python, you gain a solid all-round understanding of how programming works. Python's syntax is very similar to most other common programming languages, so once you gain confidence in Python you will find that your knowledge can easily be applied elsewhere.

Learning Python isn't just about learning a programming language. We learn programming so that we can have another tool in our skills toolbox to help us solve problems we may come across in the world.

Having strong programming skills doesn't mean you will get a job as a programmer one day, but it does mean that in any career you choose, you will be able to use your programming to do great things.

Scientists of all kinds use Python in their everyday work to understand complex data sets and find patterns in their results. Business people use programming to understand their financial data and information about their customers, to make sensible plans for the future. Artists use programming too, building interactive art to surprise and delight.

Programming is not just for programmers, it's for everyone.


Activities

  • Code Stars Video Watch this cool video to find out a bit about what it's like to have a job as a programmer, what you can create using code, and why we are learning programming.

  • ?

  • ?


Questions

  • Why do you want to learn Python?
  • What are three jobs where you could use programming, and how might you use it?

Activities

Code Stars Video


Presentation Slides


What's New In Python 3

If you're game for some reading, here's an article on what's new in Python 3.

It's quite technical, but see if you can identify two or three of the changes, even if you don't quite understand what they are!


Why We Choose Python

See if you can use this blog post by web development company Six Feet Up to answer the tricky quiz questions below.


Design a Poster

Using your knowledge of the cool things you can do with Python programming, create a poster to encourage others to give it a go.

Think about something which may encourage them to learn about Python, and centre your poster theme around that. Make sure to also include a website address they can visit for more information!

Missions

Complete the missions below to test your knowledge of The Power of Python. Make sure that you have completed all of the missions before moving on to the next topic.

See how many you can do without looking up the answers!

Understand

Understand what Python is and what it's used for.

  • Define what is meant by "programming language".

  • Name three or more different types of application you can make with Python.

  • Find an example program someone has made for each type of Python application.

  • Name three or more platforms where Python programs can be run.


Explore

Explore how Python is used to solve problems.

  • Describe why Python is a good programming language for beginners.

  • List three reasons why you might choose to use Python 2.7 instead of Python 3.


Master

Master your knowledge of Python's purpose and its context in computer programming.

  • Explain the difference between a program and a platform.

  • Create a list of platforms and provide examples of some Python programs you might run on each of them.