Machine Translated by Google
Program a Python 3
Machine Translated by Google
2- the Python language
ÿ Python is a cross-platform language, meaning it is available on several
architectures (compatible with PC, tablets, smartphones, low-cost Raspberry computers
Pi...) and operating systems (Windows, Linux, Mac, Android...).
ÿ It has strong dynamic typing
ÿ The Python language is free, under an open source license.
ÿ It is one of the most popular computer languages along with C, C++, C#, Objective-C,
Java, PHP, JavaScript, Delphi, Visual Basic, Ruby et Perl
ÿ Currently, Python is at version 3. However, version 2 is still widely
used.
Warning: Python 2 is not compatible with Python 3!
2
Machine Translated by Google
2-1 History of language
ÿ In 1989, Guido Van Rossum (born January 31, 1956 in the Netherlands)
started working on Python
ÿ Guido's goal was to invent a successor to the ABC language, a
learning language not very popular in academia.
ÿ To do this, he directly called upon Unix users who were accustomed to
C language. He wanted Python to be easily usable in
other languages and environment unlike ABC. He succeeded
globally…
3
Machine Translated by Google
2-1 History of language
ÿ A fan of the Monty Python television series, he decided to name this project Python
ÿ Python is maintained by a community of volunteers, under the umbrella of the Python
Software Foundation
4
Machine Translated by Google
2-2 Why Python?
ÿ Simple but powerful (scalable)
ÿ Efficient, and comes with many libraries (Battery included!)
ÿ Very readable, educational code
ÿ Increasingly used (Google, FreeCAD, ...) ÿ
Free software, available on all platforms (Windows, Linux, Mac
OS, etc.)
5
Machine Translated by Google
Ranking of the most popular programming languages
(2015-2016)
http ://www.tiobe.com/index.php/content/paperinfo/tpci/
Machine Translated by Google
Ranking of programming languages (2016-2017)
Machine Translated by Google
Ranking of programming languages (2019-2020)
Machine Translated by Google
Ranking of programming languages (2020-2021)
Machine Translated by Google
Ranking of programming languages (2021-2022)
Machine Translated by Google
2-3 What can you do with Python?
ÿ scientific computing ( NumPy library)
ÿ graphics ( matplotlib library)
ÿ sound processing, voice synthesis (eSpeak library)
ÿ image processing ( PIL library), artificial vision by camera
(framework SimpleCV)
ÿ bioinformatics ( Biopython library)
ÿ applications with GUI graphical interface
(librairies Tkinter, PyQt, wxPython, PyGTK...)
ÿ 2D video games ( Pygame library)
11
Machine Translated by Google
2-3 What can you do with Python?
ÿ des applications Web (serveur Web Zope ; frameworks Web Flask, Django ;
framework JavaScript Pyjamas)
ÿ interface with database management systems ( MySQLdb library, etc.)
ÿ network applications ( Twisted framework)
Tens of thousands of libraries are available on the official PyPI repository.
ÿ Machine Learning (scikit learn)
12
Machine Translated by Google
Great references
ÿ NASA,
ÿ Google,
ÿ YouTube
ÿ edx
ÿ Netflix
ÿ
….
13
Machine Translated by Google
What do you need to program in python
Programming in python requires:
ÿ a text editor (eg: gedit, wordpad, emacs, ...)
ÿ a python interpreter (a program capable of understanding the
programs written in python).
14
Machine Translated by Google
IDLE
ÿ IDLE is an Integrated Development Environment (IDE)
Development Environment) pour Python.
IDLE offers a number of tools:
or a text editor (to write the program)
or an interpreter (to run the program)
or a debugger (to test the program)
ÿ There are other IDEs for Python: Thonny, PyCharm, Spyder , …
15
Machine Translated by Google
Installation
ÿ Download the latest version (3.10) from the official website
https://www.python.org/downloads/
After installation:
Interactive mode
16
Machine Translated by Google
Execution modes in python
ÿ There are two modes of running python:
ÿ Interactive mode : open a terminal, and evaluate expressions by interacting
with python.
Interpreter = Improved Calculator
ÿ Batch mode: open a terminal and ask python to execute the
instructions of a program contained in a file (.py) We will also speak of
scripts python.
17
Machine Translated by Google
Interactive mode: Example
18
Machine Translated by Google
Mode Batch ou script
ÿ Lancer IDLE
ÿ Click on File -> New File
ÿ Save the file
ÿ Type the source code
ÿ To interpret click on: Run ->Run Module (or F5)
19