HTTPS SSH

Python Demos

This repository hosts many examples of programs written in Python 2.7, for the CS101 Course at Mahindra Ecole Centrale (spring semester 2015).


This is not an introduction to Python

Before looking at the examples provided here, be sure to be familiar with the bases of Python 2.7. If needed, work as much as you can on this website introToPython.org:


So what is this about? And why?

In February 2015, some students asked me about the possibility of frequently sharing small and interesting Python programs.

The reason seems to be that some of you want to be able to see what Python can really be used to do, and how does a real world Python program look like (a program designed to solve a concrete problem and not just an example in the lab).

Warning: this is external to the CS101 course

All these examples are NOT related to what will be covered in CS101 lectures and labs, and are NOT related to what will be asked in the lab exams and written exams. I am sharing all these demos only for interested students who would like to discover a little more.

These examples and demos are here only to show you what Python can do when used cleverly for some examples of scientific computing, problem solving, plotting etc (a list of covered domain is given below).

But reading one or two "real world" Python example from time to time might help you, mainly by triggering your interest. No need for spending time on each programs, no need for reading the documentation of the modules I used, and no need of asking me endless questions about how I did on thing, why I did another one etc.

But, please, feel free to contact me if needed, or by email at CS101 at crans dot org (obviously, replace at with @ and dot with .).


And that might be true: reading examples can help you

I (Prof. Lilian) quickly created a git repository from my "Python Scripts" Spyder folder that I use on Windows, and shared all (almost all) the programs written from January 2015.

As far as now, these examples are publicly available at bitbucket.org/lbesson/python-demos. And you can subscribe to its news feed at goo.gl/MesGzF.

I will really try to produce one or two new programs every week (Friday/Saturday usually).

And you can even send me what you write, I will probably change it a little bit, and upload it here!

Many examples from various domains (which are NOT in the syllabus for CS101)

It currently contains about 45 examples, covering:

The CS101 course is over, but maybe I will still write more examples, from time to time.

Contact me if needed?

  • If you want a specific example, please contact me through Moodle, by email, here on this form online.
  • If you found any issue in one of the programs shared here, or if you have any suggestion, feel free to open a bug ticket (it's free, easy, and open to anyone without being logged in).

Other resources for the CS101 course

The main reference for you is the CS101 page on the MEC Moodle portal (access restricted).

I also wrote a complete solution for two of the 6 programming project we gave at MEC:

  • MEC CS101 : Integrals, the task was to implement various methods for computing definite integrals numericall (in 1D but not only),
  • MEC CS101 : Matrices, a project about linear algebra operations and matrices.

Project Euler

This file contains my (current) solutions for the Project Euler challenge.

/!\ Warning: do not spoil yourself the pleasure of solving these problems by yourself!!

I (Prof. Lilian) started in February 2015, and usually solve one problem every week (when I have the time!): Badge giving the number of solved problems


Author | License ?

Except if something else is mentioned, all these files have been written by Lilian Besson and are copyrighted (C) 2015. All these files are here publicly released, under the conditions of GNU Public License v3.

I might switch to the MIT License, but this does not really change anything for you.