Skip to content

Session material and solutions for the Beginner's Python course at the AstraZeneca Code Club

License

Notifications You must be signed in to change notification settings

THargreaves/beginners-python

Repository files navigation

Beginner's Python

Session material and solutions for the Beginner's Python course at the AstraZeneca Code Club

Spotted a mistake, dead link, or have suggestions for improvements? Report these here

Navigation:

Introduction

AstraZeneca Code Club's Beginner's Python course is designed for anyone completely new to Python or even programming in general. The course is self-contained and approaches the language in a slow and friendly manner, assuming no prior knowledge. All of our resources are free to be used by anyone—AZ employee or not. If you are an employee of AZ however, make sure you follow the Code Club group on Workplace for updates, support, and general Python fun.

Have fun learning!

Getting Started

Using Google Colab (Recommended)

To make learing Python as simple as possible, we have centred our course around the use of Google Colab, a free, interactive cloud environment for Python programming. You can get setup with Colab by visiting this link or searching for Google Colab (using Google Chrome, as this has the best compatibility, unsurprisingly). Sign up using a Google account and get started by going to File > New Python 3 Notebook.

All of our exercise and solution sheets also have links to open them in Colab. Once you are finished with your work, save these to your own drive using File > Save a Copy in Drive.

Using Anaconda Locally (Optional)

If you wish to avoid using Google Colab or want to code without an internet connection, you can setup up Anaconda on your computer to obtain a similiar, but local, experience. If you are on an AZ computer, use the software store to download this, and for personal computers visit this link. Once you have Anaconda installed, open the Anaconda Navigator (this is just a normal program you'll find in your start menu). Then, launch 'Jupyter Notebook' and click New > Python 3 Notebook. This will create a blank Python 3 notebook just like with Colab. You can still use our templates by downloading the raw file from GitHub, placing it in your documents, and navigating to it in Jupyter.

Using This Repository

Each session is contained in its own folder and includes the Powerpoint presentation given in the session, an answer template for the session exercises, a homework sheet to practice your skills, as well as corresponding solutions. All exercise and solutions notebooks will contain a link at the top of the page to open the document in Google Colab

The project solution is intended to be a model solution containing full documentation and testing. It is not expected for you to add such additional components to your solution but rather you should focus on the essential parts. A full solution is only provided as indication of the direction we want to be heading in and to build up experience with looking at source code.

Quick Access to Resources

We are still working on transferring the course to this repo, improving and standardising the content in the process. Links will appear here as soon as they are ready (which hopefully won't be long). If you want to be updated when changes are made, sign up to GitHub and click the watch icon at the top of the page (whilst you're at it, stars are appreciated!).

Presentations

Templates

Homework

Session Summaries

Session 1

  • Get set up on Google Colab
  • Let Python 'talk' to you using the print() function
  • Use Python as a basic calculator
  • Give Python 'memory' using variables

Session 2

  • 'Talk' back to Python using the input() function
  • Learn why variable types are important
  • Use lists to store multiple numbers
  • Compute attributes of lists such as total, length, minimum and maximum

Session 3

  • Learn how to compare two difference numbers with comparison operators
  • Combine conditions using Boolean operators
  • Add logic to your code using if, elif, and else
  • Use while loops to repeatedly run blocks of code

Session 4

  • Recap the use of lists in Python and use them to store more than just numbers
  • Learn how to access individual items of lists as well as extract sub-lists
  • Manipulate lists, adding, removing, and altering elements
  • Understand the difference and similarities between tuples and lists

Session 5

  • Learn how to use for loops to run code a predetermined number of times
  • Loop through lists and ranges of numbers
  • Escape loops using break and continue
  • Learn how to enumerate loops

Session 6

  • Create functions to modularise your code
  • Add function parameters
  • Apply recursive strategies to solve common problems
  • Understand the nature of variable scope

Session 7

  • Learn the limitations of lists/tuples
  • Use dictionaries to overcome these
  • Manipulate dictionaries, as with lists
  • Loop through dictionaries in multiple ways

Session 8

  • Read from a text file
  • Write text to a file
  • Learn how to raise errors
  • Use common built-in packages in your code

What now?

Checkout my other courses (written by me, in parallel with the AZ Code Club):

  • Practical Python — learn more Python by applying your skills to fun, real-life problems. Prerequisite: Beginner's Python or equivalent
  • Into the Tidyverse — learn your way around the tidyverse, a collection of R packages desgined to make data importing, manipulation, and visualisation as simple as possible. No prerequisites.
  • SQL for Scientists (coming soon)

Getting Help

If you are internal to AstraZeneca your best port of call for recieving help with this course is via the Code Club workplace page. We're a friendly bunch so don't feel scared to post a question even if it seems simple—likely there is someone else with the same issue.

Failing that, any of the core contributers will be happy to help or prompt you in the right direction.

If you are external to AstraZenca, feel free to reach out to me on LinkedIn.

On top of any support the AZ Code Club can offer, there are many open-source resources for learning Python. Here are some of our favourites:

Acknowledgements

The original contributers to this course are (in alphabetical order):

  • David McKinney
  • Mark Porter
  • Ryan Whittaker
  • Sam Bradley
  • Tim Hargreaves

The current version of the course is a vast redesign of the original material, with the addition of homework, solution notebooks, and content for three additional weeks. This adaptation was made solely by Tim Hargreaves, who also manages this repository.

About

Session material and solutions for the Beginner's Python course at the AstraZeneca Code Club

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published