Introduction To Python: by Dr. Tamer Ahmed Farrag
Introduction To Python: by Dr. Tamer Ahmed Farrag
By
Dr. Tamer Ahmed Farrag
Course No.: 803427-3
Why Python?
Free Universal
Easy to learn Rich collection of numerical
Easy communication methods, plotting or data
Efficient code processing tools.
2
Python Language
• The language: flow control, data types (string, int), data collections (lists,
dictionaries), etc.
• Modules of the standard library: string processing, file management,
simple network protocols.
• A large number of specialized modules or applications written in Python:
web framework, etc. … and scientific computing.
• Development tools (automatic testing, documentation generation)
3
Most important Add-on libraries
4
Installing Python
5
ANACONDA distribution overview
6
interactive environments and
text editors
There is many methods to start programming using python includes:
1- Using Command window
3- Using Interactive environments
2- Using Text Editors and IDEs
7
interactive environments and
text editors (cont.)
Using Interactive environments (my recommend method during learning)
an interactive work with the IPython console from anaconda prompt, or its
offspring, the Jupyter notebook from Anaconda Navigator.
Start Anaconda Navigator
Launch Jupyter notebook and start working
See also
• IPython user manual: http://ipython.org/ipython-doc/dev/index.html
8
• Jupyter Notebook QuickStart: http://jupyter.readthedocs.io/en/latest/content-quickstart.html
interactive environments and
text editors (cont.)
Using Text editors and IDEs
Tens IDEs are available for python but the best of them includes:
• Microsoft Visual Studio
• Pycharm IDE
• Pydev IDE
• Vim
• Atom
• Netbeans
See also
https://www.visualstudio.com/vs/python/ 9
Python Language
10
Python Basics
The >>> is called a prompt. This is where python waits for instructions.
It is like an ear constantly waiting for orders to be executed. Entering an
instruction means typing it at the command line prompt and
pressing return.
11
Python Variables
12
Python Variables (cont.)
13
Python Operators Precedence
14
Python Operators Example
15
Asking the user for input
Python provides a built-in function called input that gets input from the
keyboard.
When this function is called, the program stops and waits for the user to
type something.
When the user presses Return or Enter, the program resumes and input
returns what the user typed as a string.
16
Comments
Comments in Python start with the hash character, #, and extend to the
end of the physical line.
A comment may appear at the start of a line or following whitespace or
code, but not within a string literal.
A hash character within a string literal is just a hash character.
Comments are to clarify code and are not interpreted by Python, they may
be omitted when typing in examples.
17
Resources
18