GithubHelp home page GithubHelp logo

python-intro's Introduction

Introduction to Python - available from https://gitlab.erc.monash.edu.au/andrease/Python4Maths.git

The original version was written by Rajath Kumar and is available at https://github.com/rajathkumarmp/Python-Lectures. The notes have been updated for Python 3 and amended for use in Monash University mathematics courses by Andreas Ernst

Python-Lectures

Introduction

Python is a modern, robust, high level programming language. It is very easy to pick up even if you are completely new to programming.

Python, similar to other languages like matlab or R, is interpreted hence runs slowly compared to C++, Fortran or Java. However writing programs in Python is very quick. Python has a very large collection of libraries for everything from scientific computing to web services. It caters for object oriented and functional programming with module system that allows large and complex applications to be developed in Python.

These lectures are using jupyter notebooks which mix Python code with documentation. The python notebooks can be run on a webserver or stand-alone on a computer.

To give an indication of what Python code looks like, here is a simple bit of code that defines a set $N={1,3,4,5,7}$ and calculates the sum of the squared elements of this set: $$\sum_{i\in N} i^2=100$$

N={1,3,4,5,7}
print('The sum of ∑_i∈N i*i =',sum( i**2 for i in N ) )
The sum of ∑_i∈N i*i = 100

Contents

This course is broken up into a number of notebooks (chapters).

  • 00 This introduction with additional information below on how to get started in running python
  • 01 Basic data types and operations (numbers, strings)
  • 02 String manipulation
  • 03 Data structures: Lists and Tuples
  • 04 Data structures (continued): dictionaries
  • 05 Control statements: if, for, while, try statements
  • 06 Functions
  • 07 Classes and basic object oriented programming

This is a tutorial style introduction to Python. For a quick reminder / summary of Python syntax the following Quick Reference Card may be useful. A longer and more detailed tutorial style introduction to python is available from the python site at: https://docs.python.org/3/tutorial/

Installation

Loging into the web server

The easiest way to run this and other notebooks for staff and students at Monash University is to log into the Jupyter server at [https://sci-web17-v01.ocio.monash.edu.au/hub]. The steps for running notebooks are:

  • Log in using your monash email address. The first time you log in an empty account will automatically be set up for you.
  • Press the start button (if prompted by the system)
  • Use the menu of the jupyter system to upload a .ipynb python notebook file or to start a new notebook.

Installing

Python runs on windows, linux, mac and other environments. There are many python distributions available. However the recommended way to install python under Microsoft Windows or Linux is to use the Anaconda distribution available at [https://www.continuum.io/downloads]. Make sure to get the Python 3.5 version, not 2.7. This distribution comes with the SciPy collection of scientific python tools as well as the iron python notebook. For developing python code without notebooks consider using spyder (also included with Anaconda)

To open a notebook with anaconda installed, from the terminal run:

ipython notebook

Note that for the Monash University optimisation course additional modules relating to the commercial optimisation library CPLEX and possibly Gurobi will be used. These libraries are not available as part of any standard distribution but are available under academic licence and are included on the Monash server.

How to learn from this resource?

Download all the notebooks from Moodle or https://gitlab.erc.monash.edu.au/andrease/Python4Maths.git

Upload them to the monash server and lauch them or launch ipython notebook from the folder which contains the notebooks. Open each one of them

Cell > All Output > Clear

This will clear all the outputs and now you can understand each statement and learn interactively.

License

This work is licensed under the Creative Commons Attribution 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by/3.0/

python-intro's People

Contributors

marisanest avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.