{ "cells": [ { "cell_type": "markdown", "metadata": { "nbpresent": { "id": "dc7a1635-0bbd-4bf7-a07e-7a36f58e258b" }, "slideshow": { "slide_type": "slide" } }, "source": [ "# An introduction to solving biological problems with Python" ] }, { "cell_type": "markdown", "metadata": { "nbpresent": { "id": "53eee250-b3d0-4262-ad09-e87fb2acf82e" }, "slideshow": { "slide_type": "-" } }, "source": [ "## Today's Presenters\n", "- Anne\n", "- Niall" ] }, { "cell_type": "markdown", "metadata": { "nbpresent": { "id": "21082cb9-e1b9-4fe9-80d5-9d9e8418937b" }, "slideshow": { "slide_type": "slide" } }, "source": [ "## Learning objectives\n", "- **Recall** how to print, create variables and save Python code in files\n", "- **List** the most common data types in Python\n", "- **Explain** how to use different type of collections\n", "- **Use and compare** these concepts in different code examples \n", "- **Propose and create** solutions using these concepts in different exercises" ] }, { "cell_type": "markdown", "metadata": { "nbpresent": { "id": "ceb5f5a0-a5e8-435e-ae16-23c2ba8c6ab2" }, "slideshow": { "slide_type": "slide" } }, "source": [ "## Course schedule - day one\n", "\n", "- 09:30-10:00: [0h30] **Introduction**\n", "- 10:00-10:30: [0h30] **Session 1.1** - Print and Variables\n", "- 10:30-10:45: *break*\n", "- 10:45-12:15: [1h30] **Session 1.2** - Simple data types, Arithmetic and Saving code in files\n", "- 12:15-13:30: *lunch break*\n", "- 13:30-14:30: [1h00] **Session 1.3** - Collections: Lists and String \n", "- 14:30-14:45: *break*\n", "- 14:45-15:45: [1h00] **Session 1.4** - Collections: Sets and Dictionnaries\n", "- 15:45-16:00: *break*\n", "- 16:00-17:00: [1h00] **Wrap-up** " ] }, { "cell_type": "markdown", "metadata": { "nbpresent": { "id": "e6c2e441-eb7b-4a4c-9c9c-b88cc9a2527f" }, "slideshow": { "slide_type": "slide" } }, "source": [ "## Course schedule - day two\n", "\n", "- Conditions, Loops and Files" ] }, { "cell_type": "markdown", "metadata": { "nbpresent": { "id": "8458de53-35b5-405e-a372-5db5d2e2c2c5" }, "slideshow": { "slide_type": "slide" } }, "source": [ "## Course materials\n", "\n", "- There is a course webpage with links to the materials, example solutions to the exercises etc.:\n", " - http://pycam.github.io\n", "- All course materiel is available on GitHub in our [python-basic repo](https://github.com/pycam/python-basic)\n", "- Weâd like you to follow along with the example code as we go through the material, and attempt the exercises to practice what youâve learned\n", "- Questions are welcome at any point!\n", "- If you have specific projects/problems you like to use Python for we are happy to (try to) help during the exercises\n" ] }, { "cell_type": "markdown", "metadata": { "nbpresent": { "id": "96ca5c44-2cfc-471c-8da7-39870c822e20" }, "slideshow": { "slide_type": "slide" } }, "source": [ "## What is *Python*?\n", "\n", "- Python is a *dynamic, interpreted* general purpose programming language initially created by Guido van Rossum in 1991\n", "- It is a powerful language that supports several popular programming paradigms:\n", " - procedural\n", " - object-oriented\n", " - functional\n", "- Python is widely used in bioinformatics and scientific computing, as well as many other fields and in industry\n", "- Python is available on all popular operating systems\n", " - Macs\n", " - Windows\n", " - Linux" ] }, { "cell_type": "markdown", "metadata": { "nbpresent": { "id": "9110098b-9675-4d64-adf3-c947073d4c4d" }, "slideshow": { "slide_type": "slide" } }, "source": [ "## The Python programming language\n", "\n", "- Python is considered to come with \"batteries included\" and the standard library provides built-in support for lots of common tasks:\n", " - numerical & mathematical functions \n", " - interacting with files and the operating system\n", " - ..." ] }, { "cell_type": "markdown", "metadata": { "nbpresent": { "id": "0d61b4b4-163f-47fe-80f1-092287218273" }, "slideshow": { "slide_type": "slide" } }, "source": [ "## Getting started\n", "\n", "- Python is an *interpreted* language, this means that your computer does not run Python code natively, but instead we run our code using the Python interpreter\n", "- There are three ways in which you can run Python code:\n", " - Directly typing **commands into the interpreter**: *Good for experimenting with the language, and for some interactive work*\n", " - Using a **Jupyter notebook**: *Great for experimenting with the language, and for sharing and learning*\n", " - Typing code **into a file** and then telling the interpreter to run the code from this file: *Good for larger programs, and when you want to run the same code repeatedly*\n" ] }, { "cell_type": "markdown", "metadata": { "nbpresent": { "id": "b878a4f9-4345-4abb-81f4-5a731c639ab8" }, "slideshow": { "slide_type": "slide" } }, "source": [ "## How to start the Python interpreter?\n", "\n", "- How you start the interpreter will depend on which operating system you are using, but on a Mac or Linux machine you should start a terminal and then just type the command `python3`\n", "- This will print out some information about your installation of python and then leave you with a command prompt which looks like `>>>` \n", "- You can then type commands and press `Enter` when you're done. Python will run the code you typed, and might display some output on the line below, before leaving you with another prompt.\n", "- If you want to exit the interactive interpreter you can type the command `quit()` or type `Ctrl-D`" ] }, { "cell_type": "markdown", "metadata": { "nbpresent": { "id": "8a4ac456-6c4b-4249-8662-b1cabfd7cee4" }, "slideshow": { "slide_type": "slide" } }, "source": [ "## The terminal\n", "\n", "We will see later how to save code in a file and run it.\n", "
