Skip to content
A collection of 100+ Python exercises.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Solutions
Workbook
README.md
requirements.txt

README.md

Python Exercises

Binder

A collection of 100+ Python exercises (including solutions) covering: Basic operations, variables, output and input, string operators, math operators, libraries, logical operators, IF and ELSE statements, lists, loops, and file operations.

Preface

The exercises in this workbook were designed for an ’Introduction to Python’ course aimed at complete beginners. The course material itself is only available to course participants. If you are a course participant, you can download the lectures slides, demonstrations, and additional supporting material either from the Google Classroom or from here.

While the exercises are best used in combination with the course, they can also be used for independent study. I made an effort to come up with exercises you won’t find in books or online, so hopefully you should be able to find new projects even if you’ve been using other online resources. The topics included in the workbook are: Basic operations, variables, output and input, string operators, math operators, libraries, logical operators, IF and ELSE statements, lists, loops, and file operations. Note that neither functions or classes are included in the syllabus. I have included a couple of extra exercises covering functions and classes at the end but they are not very extensive as they are meant to be a backup only. While the solutions to the exercises won’t make use of functions I highly recommend working with functions if you know how to.

File Structure

A PDF (and the LaTeX source) of the Workbook can be found under Workbook/Workbook_IntroductionToPython.pdf. Every exercise is assigned an ID number, the corresponding solutions are available at Solutions/ID/.

How to use this Workbook

This workbook is intended for absolute beginners with no prior knowledge of coding. If you do have some coding experience you will probably be able to skip some easier exercises. The chapter titles and hints below each exercise will point you to the knowledge required to solve the problems. If you are not taking the course, have a look at the tutorials listed below to learn the concepts before tackling the exercises:

The exercises themselves are divided into three levels of difficulty:

  • EASY: These exercises represent a gentle introduction to a new topic. I recommend starting with these exercises unless you already feel more confident.
  • MEDIUM: These exercises will ask you to apply what you’ve learned with some level of abstraction.
  • HARD: These exercises will ask you to apply what you’ve learned to solve a more complex problem and are intended for learners looking for something a bit more challenging.

Additionally, some exercises will be marked with a red M. This indicates that the exercises contain more advanced mathematical concepts that might be unsuitable for some learners. Feel free to skip these if you’re not comfortable with maths.

Solutions

All solutions are provided in the form of Jupyter Notebooks and Python scripts. Solutions are tailored to the content covered in the course. If you learn using a different source, you might be able to solve the exercise more efficiently (e.g. with function). If an exercise requires input files you can download these from the same folder as the solutions.

How to get in Touch

For enquiries please get in touch via the contact form on my website or send me an email here.

You can’t perform that action at this time.