{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# What is Python?" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "notes" } }, "source": [ "![Python Logo](https://www.python.org/static/community_logos/python-logo-master-v3-TM.png)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# First, what is 'Programming'?" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "Being good at programming is about:\n", "\n", "* understanding a problem conceptually and being able to translate it into code\n", "* thinking of new ways to tackle (for example) a scientific problem, and knowing what tools to use\n", "* knowing how to fix your program when it does not work\n", "* writing a program that is fast **enough**, **not** the fastest possible\n", "* writing a program that can be understood by other people (or by yourself after some time has passed)" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "notes" } }, "source": [ "The last point is important, because **reproducible research** and **open science** is becoming the norm in certain fields of research. This means that others have to be able to read your code, and understand what you are doing, and be able to run it themselves. For this course, we are not just interested in whether your solutions are correct, but also whether it is possible to understand how you are solving the problem. You should always write code assuming that someone else may read it." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "This course focuses on aspects of programming that would be useful to you in scientific research, but Python is a very popular language, and what you will learn will also be applicable if you decide to pursue a different career." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## How does Python compare to other languages?" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "Python is an **interpreted** language, which means that the code is not compiled in advance. This makes it slower than programming languages like C/C++ or Fortran. Why therefore would we want to learn/use it?\n", "\n", "* It has a clean and simple syntax which emphasises readability\n", "* It can be much faster to write programs in python than other languages\n", "* It gives detailed errors by default which makes it easier to fix bugs\n", "* It is easy to use for interactive analysis\n", "* It has a large \"ecosystem\" of packages available for everything from numerical analysis, databases, graphical interfaces, web scraping...\n", "* It is straightforward to interface with C/Fortran code\n", "* It can interact with command-line programs, and other languages\n", "* Some Packages (e.g. Numpy for arrays) are written in C, which means that we get the convenience of Python and the speed of C\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Why is it called 'Python'?" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "Even though the Python logo has snakes in it, Python originally comes from the [Monty Python](http://en.wikipedia.org/wiki/Monty_Python) comedy group [\"Monty Python's Flying Circus\", \"Monty Python's Life of Brian\", \"Monty Python and the Holy Grail\"]\n", "\n", ".. a lot of Python documentation includes jokes related to Monty Python." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## A note on Python 2 vs 3" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "The latest version of Python is currently 3.7.\n", "\n", "Sometimes one still encounters python version 2.7 (the latest 2.x release). But this is not recommended anymore, we'll only use Python 3 here." ] } ], "metadata": { "anaconda-cloud": {}, "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.5" } }, "nbformat": 4, "nbformat_minor": 1 }