Beginning to Code with Python: Notes, Examples and Exercises

This repository contains code fragments, notes and exercises from the book Begin to Code With Python by Rob Miles. The book is available at the official Microsoft Press Store.

I started this repository to work through an easy and basic book before working on some more intermediate level python projects and books.

Contents

Part 1. Programming Fundamentals

Part 2. Advanced Programming

Part 3. Useful Python

Useful Python

Important

Chapter 1 only provides basic information on installing python and assumes a Windows environment so is not covered in these notes

Python Version and Writing Style

  • The original book was written with python 2.X and python 3.6 in mind.
  • Currently we’ve written the code using python 3.12.
  • Small changes have been made to the supplied code to resolve the following issues:
    1. snaps get_string function not allowing the user to actually supply input
    2. snaps display_image modified to deal with issues where .png files might not display
  • In general the code style of the solutions is restricted to elements of the python language introduced up until that point
    • For some of the extension exercises we have gone beyond that by still restricting ourselves to concepts that have been introduced, e.g
      1. We use random.choice to select random items from a list, after having been exposed to both the random and list libraries
      2. We use the string method find after having been introduced to the concept of string methods and substrings searching with startswith
      3. We use the datetime module to simplify arithmetic on date and time objects after having extensively used the time module
      4. The final Banking Application example in Chapter 13 uses some tkinter elements that are not discussed,but are documented online