Folders

See these subfolders for more documents:

License

All these files are publicly distributed under the terms of the MIT license.

Introduction to the CS101 course at MEC


This is a really quick introduction to computer programming, CS and Python for the CS101 course.



  1. Reading this document will give you a short overview of what you will learn at Mahindra École Centrale (MEC) during the CS101 course and why you will learn it. This course will be given in the second semester of 2014-2015 (from January 2015 to May 2015).
  2. A lot of resources are available (websites, videos, on-line courses, problems, textbooks etc). You should try to spend some time reading, viewing or working on these, by your own: before the beginning of the course but also during the course.
  3. During the December (2014) break, you will have 4 weeks without any class, and working on that CS101 course is an excellent way for you to prepare the second semester, to stay focus on learning, and maybe to have some fun!


Any remarks?

This document can be improved, thanks to you. If needed, please fill a bug report, it's quick and easy.



1) How to (quickly) start to learn computer programming (with Python)

  1. Read carefully this document, from here to the last page. Using a soft copy (from a computer or a smartphone) is better, as this document contains lots of hyperlinks.
  2. From continuum.io/downloads, download Anaconda and install¹ the latest version of Python on your own computer (if you have one, it is probably running on Mac OS X, Windows or Linux). You can also try one of the on-line Python interpreters (no need to install anything).
  3. Go read the main reference websites and documents (main links are given below).
  4. Start to get used to the user interface of the EDI we will used for the course: Spyder (it is included in Anaconda).
  5. Practice with the first examples from introtopython.org/hello_world.html.
  6. (Optional) If needed, read these FAQ: general Python FAQ, programming FAQ, or Python on Windows FAQ, or ask us any question by email at CS101 @ crans.org.
  7. Keep practicing by going through the IntroToPython.org mini-lessons, watching PythonLearn.com videos, or reading Python.org tutorials. The most important thing is to write code by yourself!

Note (¹):



Keep reading!

You read the first part of this document, go on, you can continue, yes, you will make it!



2) Quick explanation of what is computer programming

Computer programming (often shortened to programming) is a process that leads from an original formulation of a computing problem to executable programs.

It involves activities such as analysis, understanding, thinking, and generically solving such problems resulting in an algorithm, verification of requirements of the algorithm including its correctness and its resource consumption, implementation (commonly referred to as coding) of the algorithm in a target programming language.

Computer programming and software engineering are nowadays one of the most popular activities for newly trained engineers, and lots of you will probably do internships or find your first jobs in an IT company!

2.1) Main properties a computer program should satisfy

Whatever the approach to development may be, the final program must satisfy some fundamental properties.

The following properties are among the most relevant:

  1. Usability: the ergonomics of a program, ie the ease with which a person can use the program for its intended purpose or in some cases even unanticipated purposes.
  2. Reliability: how often the results of a program are correct.
  3. Readability: to the ease with which a human reader can comprehend the purpose, control flow, and operation of source code.
  4. Robustness: how well a program anticipates problems due to errors (not bugs).
  5. Efficiency or performance: the amount of system resources a program consumes (processor time, memory space, slow devices such as disks, network bandwidth and to some extent even user interaction): the less, the better.
  6. Portability: the range of computer hardware and operating system platforms on which the source code of a program can be compiled/interpreted and run.
  7. Maintainability: the ease with which a program can be modified by its present or future developers in order to make improvements or customizations, fix bugs and security holes, or adapt it to new environments.

This short explanation comes mainly from Wikipédia. The linked articles give more details!

2.2) Why choosing Python?

Because it is free, excellent on the 6 firsts of these 7 key aspects, and because of how easy it is to learn and use it in comparison to the other popular languages (such as C or Java), we at MEC have decided to use Python for the CS 101 and 202 courses (the two first CS courses in the common syllabus of our 4 branches). Other languages will be used in the future for some other courses.

First example

That small 2-line program below will be Python thanking us for chosing it, by producing that output: « I am so happy that you chose me! » -- Python 2.7.6 !



# Your very first Python example program (this line is a comment, ie. will not be executed)
from sys import version  # We import one constant value from the 'sys' module
# Python is thanking us for choosing it, we print a message with the function print
print("« I am so happy that you chose me! » -- Python " + version[0:5])

3) Quick explanation of what is Python

Python is an easy-to-learn, powerful programming language, and one of the most popular in the world from the last 15 years. Python is a widely used general-purpose, high-level programming language.

It has efficient high-level data structures and a simple but effective approach to object-oriented programming. Python's elegant syntax and dynamic typing, together with its interpreted nature, make it an ideal language for beginners, but also for scripting and rapid application development in many areas and on most platforms. The Python interpreter and the extensive standard library are freely available in source or binary form for all major platforms from the Python Web site, Python.org. The same site also contains distributions of and pointers to many free third party Python modules, programs and tools, and additional documentation.

Its design philosophy emphasizes code readability, and its syntax allows programmers to express concepts in fewer lines of code than would be possible in languages such as C++ or Java.

The language provides constructs intended to enable clear programs on both a small and large scale.

Python supports multiple programming paradigms, including object-oriented, imperative and functional programming or procedural styles.

It features a dynamic type system and automatic memory management and has a large and comprehensive standard library, the result of years of hard work by a huge community scattered around the world.

This short explanation comes mainly from the Python.org Tutorial and the Wikipédia page about Python.

Feel free to follow your curiosity and go read more!


4) Some motivation for learning programming with Python

In any case, Python is just the language for you. This page (docs.Python.org/2/tutorial/appetite.html) gives a more complete overview of the many reasons to learn programming, and especially to chose Python!

4.1) Python 2 or 3?

We chose Python 2 (version 2.7) rather than Python 3.4 (for many reasons). One lecture at the end of the course might be used to highlight the main differences between the two versions, but do not worry, they are very similar! We will also quickly explain how to easily port a Python 2 code to Python 3, if necessary.


5) On-line main references

These websites are the most useful resources for learning Python, and we plan to use them a lot.



Overview of the outline for the course?

Good job, you read almost half of my document!
If you want, a temporary overview of the course can be seen here, if you are interested.
Please keep in mind that this outline can be changed (and will probably be), and is here only to give you an idea of the outline...



6) Some details about CS101

This CS101 course aims to teach all of our MEC students about the basics of programming computers and algorithmic, using Python 2.

6.1) First contact with programming!

This course is specifically designed to be your first programming course using the popular Python programming language. For a lot of you, this will be your very first contact to computer programming.

The outline of the course is designed to start from the fundamental bases and to go slowly to an intermediate level in algorithmic, problem solving using a computer program, and Python. We will use simple examples, some data analysis and some questions from chemistry, physics, maths and engineering courses as programming exercises through the course. And you will have lots of time during the CS labs to practice programming and to think on your own (but always with the help of one or more tutors and lab assistants).

Understanding how to process data is valuable for everyone regardless of your career. This course might kindle an interest in more advanced programming courses or courses in web design and development (this will be covered for the CSE branch students in third and forth years); or just provide some basic skills to help you when you are faced with a bunch of data that you need to analyze.

You can do the (first) programming assignments for the class using your personal computer or smart-phone (or even a web-browser).

All required softwares and on-line resources for the course are free (and open-source).

It is highly recommended to install Python on your own machine (with Anaconda).

Regardless if you use a Mac, a Windows or a UNIX/Linux computer, Python is available for you!

6.2) « And what if I do not have a laptop neither a smart-phone? »

Well, the programming lab sessions will happen in the computer lab, which is open for you a lot. For viewing the on-line lectures, practicing for assignments and projects and working on your own, it is recommended to have your own laptop, but you can manage without it. We will do our best to help you in case you do not have your own machine. Purchasing a laptop will help but it is not mandatory.


6.3) Thinking like a computer scientist?

The goal of this course is also to teach you to think like a computer scientist. This way of thinking combines some of the best features of mathematics, engineering, and natural science.

The single most important skill for a computer scientist is problem solving, which means the ability to formulate problems, think creatively about solutions, and express a solution clearly and accurately. As it turns out, the process of learning to program is an excellent opportunity to practice problem solving skills. On one level, you will be learning to program, a useful skill by itself. On another level, you will use programming as a means to an end. As we go along, that end will become clearer, especially with the programming project you will have to do in March and April 2015.


6.4) Technical details

This small paragraph gives some logistic details, for you to know how this CS101 course will be conducted.

Some of these details can still change.

Team for CS101

The CS101 course will be half time of lectures, and half time of labs, and many professors will be there for both lecturing and conducting the labs:

  1. Four professors for lectures and labs: Founder Director of MEC Prof. Sanjay G. Dhande will give the first lectures, and then Prof. Aryakumar Bhattacharya, Lilian Besson and Dr. Vipin Kizheppatt will take care of the lectures and the labs.
  2. Two professors for labs and projects: Prof. P Kondaiah, Prof. Vivek Bajpai will help to conduct labs, and be in charge of helping you (the students) for the two programming projects on a regular basis.
  3. Four labs/computer assistants: Aakash Deep, Nagendar, Srinivas and Ashish Roy will help us to keep the two computer labs in order, and to help conducting labs and projects.

Other aspects

  1. Number of hours: this course will use 2 hours of weekly lectures and 2 hours of weekly computer lab, all being mandatory. Attendance will be taken, and too many absences will be punished.
  2. Rooms: lectures will be in one of the lecture theater (LT 1 to 5), and labs will happen in the computer lab room or the drawing (AutoCad) lab.
  3. Evaluation: 50% will be for the written part on concept of programming and algorithmic, and 50% will be on applied programming. For the conceptual half: 10% for the two written Mid-Term Exams (mid of February, end of March), 30% for the Final Exam (in May). For the programming other half: 10% will be the first (small) project to do alone, 15% on all the labs (from January to April on various aspects), and 20% on the second project to do in small groups. This could change.
  4. Moodle will mainly be used by us to upload some lectures notes or slides and the lab exercises and assignments. You will have to use it to give us back algorithmic homeworks and programming projects, on a very regular basis.
  5. Language: English, as always, will be the only speaking and writing language used in this course. (if you are curious, you can try to write a Python program in Telugu at wiki.Python.org/moin/TeluguLanguage or in Hindi, but that's pretty much it)

7) Textbooks of reference

7.1) At the MEC library or stationary shop?

These two books are already available at the MEC library, and will be available at the MEC stationary shop. If you are impatient and want to order them by yourself, feel free to do it, either by the stationary shop or via flipkart.com!

7.2) More more on-line documentation?

These books are freely available, on-line (as soft copy). It is possible to download them once in order to read them from your (off-line) laptop or smart-phone anytime you want. All these resources will be available off-line on every computer of the CS lab, in order to allow you to consult them whenever you want.


8) Others resources

This last part gives a lot more resources and links to help you learn algorithmic, programming and Python.

8.1) More on-line courses or references

8.2) More books on Algorithms and Data Structures?

Python and concrete programming will be the main part of the CS101 course, but you will also learn about algorithms and data structures, and it will be an important part of the the course and main component of evaluations. These books are already available at the MEC library, and some will be available at the MEC stationary shop.

8.3) Which software will we use to write our Python programs?

As far as now, we decided to use the Spyder EDI for this course.

In CS 101 labs, we will be able to help you if you use the same environment as everyone, of course it will be harder if you choose something else. We will try our best, but for both you and us, it will really be simpler if you also use Spyder.

Spyder will be used on Windows and Ubuntu as the editor and software to write, execute, analyze and debug your Python programs.

Spyder has many advantages: it is free and open-source, easy to install on many platforms (Windows, Mac OS X and Linux), and it is easy to begin with. But it is also powerful enough to do everything we need for CS101, including for real projects as you will have to deal with for the second group project. The recommended way to install and keep up-to-date Python and Spyder is to use Anaconda.

(Optional) An other IDE?

But if you want to try another Integrated Development Environment (IDE), on your own:

(Learn why a text editor can be more powerful than a word processor?)

8.4) On-line interpreters

These free web-services brings all the simplicity, conciseness and greatness of Python right into your web browser! You can use any of these to quickly test a piece of code, or practice programming with your laptop or smart-phone from anywhere, without having to install Python!

  1. REPL.it/languages/Python is visually the best one, and comes with some basic examples (not working well on smart-phones).
  2. Trinket.io/python is also an excellent project aiming to « put interactive python anywhere on the web ».
  3. PythonTutor.com is a visually helpful debugger for Python. You write some simple code on the left, and then the website is showing you, step by step, what is happening when the code is executing. It will help you a lot at the beginning. Go on, try it here online.
  1. Live.SymPy.org is a math-oriented on-line interpreter, which use the powerful SymPy project, a Python library for symbolic mathematics, close to become a full-featured computer algebra system (CAS). By the way, you can also use the awesome www.SymPyGamma.com website as a powerful calculator (for maths, physics or anything) !
  2. www.Skulpt.org and www.CodeSkulptor.org are simple but good on-line interpreters, with lot of examples.
  3. Finally, console.Python.org could also help you.

8.5) Python on your smart-phone!

It is also possible to install an application on any recent smart-phone, allowing you to use Python on your device even off-line!

8.6) Fun websites to practice or learn Python programming

These websites could help you, but we will not use them. Feel free to visit them, and you can use them if you want, on your own.

These other websites are not focused on Python, but can be interesting for you, in the future.

8.7) Some powerfull Python library that makes you want to write cool projects right away


9) Credits and License

9.1) Credits

This document has be written by Lilian Besson for the Computer Science 101 course at Mahindra École Centrale, in November 2014.

Feel free to contact me for any reason, by email at CS101 at crans.org or with that (anonymous) form at perso.crans.org/besson/contact/en.

9.1) License

This document is publicly published, under the terms of the MIT License (as will be every single resource produced for the CS 101 course).

Python XKCD comic

Python comic from xkcd.com/353

Finally, all the quoted resources (websites, books, videos, slides, programs etc) are the properties of their respective authors, and neither me (Lilian Besson) nor Mahindra École Centrale are affiliated to any of them.

By the way, Python and Python.org are trademarks of the Python Software Foundation.


You DID it!

Oh my ***, you actually read the entire document, seriously? Good for you!
No, stop congratulate yourself, and go start practicing Python programming by yourself!





© 2015 Lilian Besson, based on a file generated by an open-source Python script.

GA|Analytics