SlideShare ist ein Scribd-Unternehmen logo
1 von 18
Course No.: 803427-3
By
Dr. Tamer Ahmed Farrag
Introduction to Python
2
Why Python?
 Free
 Easy to learn
 Easy communication
 Efficient code
 Universal
 Rich collection of numerical
methods, plotting or data
processing tools.
3
Python Language
Python, a generic and modern computing 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)
Unlike Matlab, or R, Python does not come with a pre-bundled set
of modules for scientific computing.
4
Most important Add-on libraries
5
Installing Python
There is two ways to Start working with python:
1- download and install the python language interpreter from the official
web site :
https://www.python.org/
Then start to install the required libraries one by one.
2- install a scientific-computing distribution, that comes readily with
optimized versions of scientific modules. For Example:
- Anaconda (recommended) - EPD - WinPython
Download Anaconda from : https://www.anaconda.com/download/ choose your
Operating system and python 3.7
6
ANACONDA distribution overview
7
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
 Using Command window:
• Open anaconda prompt
• Type Python ⏎
(The python command windows is start working)
8
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
• Jupyter Notebook QuickStart: http://jupyter.readthedocs.io/en/latest/content-quickstart.html
9
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/
10
Python Language
Python is a programming language, as are C, Fortran, BASIC, PHP, etc.
Some specific features of Python are as follows:
• an interpreted (as opposed to compiled) language. Python can be
used interactively.
• a free software released under an open-source license: Python can be
used and distributed free of charge, even for building commercial
software.
• multi-platform: Python is available for all major operating systems.
• a very readable language with clear non-verbose syntax
• a language for which a large variety of high-quality packages are
available for various applications, from web frameworks to scientific
computing.
• a language very easy to interface with other languages, in particular C
and C++.
• Some other features of the language are illustrated just below. For
example, Python is an object-oriented language, with dynamic typing
(the same variable can contain objects of different types during the
course of a program).
11
Python Basics
• Command Line Window
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.
>>>
>> x = 9 # assign the value 9 to x
12
Python Variables
 A variable is a name that refers to a value.
 In Python, No need to declare variables
 An assignment statement creates new variables and gives them values.
13
Python Variables (cont.)
 Programmers generally choose names for their variables that are
meaningful and document what the variable is used for.
 Variable names can be arbitrarily long.
 They can contain both letters and numbers, but they cannot start with a
number.
 They can contain underscore character (_).
 If you give a variable an illegal name, you get a syntax error.
 Python's keywords cannot be used as variable names.
Python reserves 33 keywords:
14
Python Operators Precedence
15
Python Operators Example
16
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.
17
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.
18
Resources
 Scipy Lecture Notes
http://www.scipy-lectures.org/
 Python for Everybody
https://www.py4e.com/
 Python official documentation
https://docs.python.org
 Anaconda web site
https://www.anaconda.com

Weitere ähnliche Inhalte

Was ist angesagt?

Fundamentals of python
Fundamentals of pythonFundamentals of python
Fundamentals of pythonBijuAugustian
 
Python quick guide1
Python quick guide1Python quick guide1
Python quick guide1Kanchilug
 
Python course syllabus
Python course syllabusPython course syllabus
Python course syllabusSugantha T
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to pythonJaya Kumari
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to pythoneShikshak
 
Introduction to python for Beginners
Introduction to python for Beginners Introduction to python for Beginners
Introduction to python for Beginners Sujith Kumar
 
11 Unit1 Chapter 1 Getting Started With Python
11   Unit1 Chapter 1 Getting Started With Python11   Unit1 Chapter 1 Getting Started With Python
11 Unit1 Chapter 1 Getting Started With PythonPraveen M Jigajinni
 
introduction of python in data science
introduction of python in data scienceintroduction of python in data science
introduction of python in data sciencebhavesh lande
 
summer training report on python
summer training report on pythonsummer training report on python
summer training report on pythonShubham Yadav
 
Seminar report on python 3 course
Seminar report on python 3 courseSeminar report on python 3 course
Seminar report on python 3 courseHimanshuPanwar38
 
WEB PROGRAMMING UNIT VIII BY BHAVSINGH MALOTH
WEB PROGRAMMING UNIT VIII BY BHAVSINGH MALOTHWEB PROGRAMMING UNIT VIII BY BHAVSINGH MALOTH
WEB PROGRAMMING UNIT VIII BY BHAVSINGH MALOTHBhavsingh Maloth
 

Was ist angesagt? (20)

Fundamentals of python
Fundamentals of pythonFundamentals of python
Fundamentals of python
 
Python quick guide1
Python quick guide1Python quick guide1
Python quick guide1
 
Introduction to python
 Introduction to python Introduction to python
Introduction to python
 
Python course syllabus
Python course syllabusPython course syllabus
Python course syllabus
 
Python
PythonPython
Python
 
Introduction to Python Basics Programming
Introduction to Python Basics ProgrammingIntroduction to Python Basics Programming
Introduction to Python Basics Programming
 
Programming
ProgrammingProgramming
Programming
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
Introduction to python for Beginners
Introduction to python for Beginners Introduction to python for Beginners
Introduction to python for Beginners
 
Introduction python
Introduction pythonIntroduction python
Introduction python
 
11 Unit1 Chapter 1 Getting Started With Python
11   Unit1 Chapter 1 Getting Started With Python11   Unit1 Chapter 1 Getting Started With Python
11 Unit1 Chapter 1 Getting Started With Python
 
introduction of python in data science
introduction of python in data scienceintroduction of python in data science
introduction of python in data science
 
Intro to Python
Intro to PythonIntro to Python
Intro to Python
 
summer training report on python
summer training report on pythonsummer training report on python
summer training report on python
 
Cmpe202 01 Research
Cmpe202 01 ResearchCmpe202 01 Research
Cmpe202 01 Research
 
Introduction to Python
Introduction to PythonIntroduction to Python
Introduction to Python
 
Seminar report on python 3 course
Seminar report on python 3 courseSeminar report on python 3 course
Seminar report on python 3 course
 
Getting Started with Python
Getting Started with PythonGetting Started with Python
Getting Started with Python
 
WEB PROGRAMMING UNIT VIII BY BHAVSINGH MALOTH
WEB PROGRAMMING UNIT VIII BY BHAVSINGH MALOTHWEB PROGRAMMING UNIT VIII BY BHAVSINGH MALOTH
WEB PROGRAMMING UNIT VIII BY BHAVSINGH MALOTH
 

Ähnlich wie 01 python introduction

Introduction to Python Unit -1 Part .pdf
Introduction to Python Unit -1 Part .pdfIntroduction to Python Unit -1 Part .pdf
Introduction to Python Unit -1 Part .pdfVaibhavKumarSinghkal
 
Session-1_Introduction to Python.pptx
Session-1_Introduction to Python.pptxSession-1_Introduction to Python.pptx
Session-1_Introduction to Python.pptxWajidAliHashmi2
 
a9855c3532e13484ee6a39ba30218896d7c0d863-1676987272842.pptx
a9855c3532e13484ee6a39ba30218896d7c0d863-1676987272842.pptxa9855c3532e13484ee6a39ba30218896d7c0d863-1676987272842.pptx
a9855c3532e13484ee6a39ba30218896d7c0d863-1676987272842.pptxcigogag569
 
Python Programming and ApplicationsUnit-1.docx
Python Programming and ApplicationsUnit-1.docxPython Programming and ApplicationsUnit-1.docx
Python Programming and ApplicationsUnit-1.docxManohar k
 
Python Book/Notes For Python Book/Notes For S.Y.B.Sc. I.T.
Python Book/Notes For Python Book/Notes For S.Y.B.Sc. I.T.Python Book/Notes For Python Book/Notes For S.Y.B.Sc. I.T.
Python Book/Notes For Python Book/Notes For S.Y.B.Sc. I.T.Niraj Bharambe
 
Python Programmimg language in Gurugram
Python  Programmimg language in GurugramPython  Programmimg language in Gurugram
Python Programmimg language in Gurugramdigitallynikitasharm
 
Web Programming UNIT VIII notes
Web Programming UNIT VIII notesWeb Programming UNIT VIII notes
Web Programming UNIT VIII notesBhavsingh Maloth
 
Python Tutorial | Python Programming Language
Python Tutorial | Python Programming LanguagePython Tutorial | Python Programming Language
Python Tutorial | Python Programming Languageanaveenkumar4
 
Python tutorial for beginners - Tib academy
Python tutorial for beginners - Tib academyPython tutorial for beginners - Tib academy
Python tutorial for beginners - Tib academyTIB Academy
 

Ähnlich wie 01 python introduction (20)

Introduction to Python Unit -1 Part .pdf
Introduction to Python Unit -1 Part .pdfIntroduction to Python Unit -1 Part .pdf
Introduction to Python Unit -1 Part .pdf
 
python-handbook.pdf
python-handbook.pdfpython-handbook.pdf
python-handbook.pdf
 
Session-1_Introduction to Python.pptx
Session-1_Introduction to Python.pptxSession-1_Introduction to Python.pptx
Session-1_Introduction to Python.pptx
 
a9855c3532e13484ee6a39ba30218896d7c0d863-1676987272842.pptx
a9855c3532e13484ee6a39ba30218896d7c0d863-1676987272842.pptxa9855c3532e13484ee6a39ba30218896d7c0d863-1676987272842.pptx
a9855c3532e13484ee6a39ba30218896d7c0d863-1676987272842.pptx
 
Chapter - 1.pptx
Chapter - 1.pptxChapter - 1.pptx
Chapter - 1.pptx
 
Python Programming and ApplicationsUnit-1.docx
Python Programming and ApplicationsUnit-1.docxPython Programming and ApplicationsUnit-1.docx
Python Programming and ApplicationsUnit-1.docx
 
Research paper on python by Rj
Research paper on python by RjResearch paper on python by Rj
Research paper on python by Rj
 
Python Programming Part 1.pdf
Python Programming Part 1.pdfPython Programming Part 1.pdf
Python Programming Part 1.pdf
 
Python Programming Part 1.pdf
Python Programming Part 1.pdfPython Programming Part 1.pdf
Python Programming Part 1.pdf
 
Python Programming Part 1.pdf
Python Programming Part 1.pdfPython Programming Part 1.pdf
Python Programming Part 1.pdf
 
MODULE 1.pptx
MODULE 1.pptxMODULE 1.pptx
MODULE 1.pptx
 
Python Book/Notes For Python Book/Notes For S.Y.B.Sc. I.T.
Python Book/Notes For Python Book/Notes For S.Y.B.Sc. I.T.Python Book/Notes For Python Book/Notes For S.Y.B.Sc. I.T.
Python Book/Notes For Python Book/Notes For S.Y.B.Sc. I.T.
 
Python Programmimg language in Gurugram
Python  Programmimg language in GurugramPython  Programmimg language in Gurugram
Python Programmimg language in Gurugram
 
Python programming
Python programmingPython programming
Python programming
 
Web Programming UNIT VIII notes
Web Programming UNIT VIII notesWeb Programming UNIT VIII notes
Web Programming UNIT VIII notes
 
python-ppt.ppt
python-ppt.pptpython-ppt.ppt
python-ppt.ppt
 
python-ppt.ppt
python-ppt.pptpython-ppt.ppt
python-ppt.ppt
 
Python Tutorial | Python Programming Language
Python Tutorial | Python Programming LanguagePython Tutorial | Python Programming Language
Python Tutorial | Python Programming Language
 
Python tutorial for beginners - Tib academy
Python tutorial for beginners - Tib academyPython tutorial for beginners - Tib academy
Python tutorial for beginners - Tib academy
 
python unit2.pptx
python unit2.pptxpython unit2.pptx
python unit2.pptx
 

Kürzlich hochgeladen

The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfCionsystems
 

Kürzlich hochgeladen (20)

The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdf
 

01 python introduction

  • 1. Course No.: 803427-3 By Dr. Tamer Ahmed Farrag Introduction to Python
  • 2. 2 Why Python?  Free  Easy to learn  Easy communication  Efficient code  Universal  Rich collection of numerical methods, plotting or data processing tools.
  • 3. 3 Python Language Python, a generic and modern computing 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) Unlike Matlab, or R, Python does not come with a pre-bundled set of modules for scientific computing.
  • 5. 5 Installing Python There is two ways to Start working with python: 1- download and install the python language interpreter from the official web site : https://www.python.org/ Then start to install the required libraries one by one. 2- install a scientific-computing distribution, that comes readily with optimized versions of scientific modules. For Example: - Anaconda (recommended) - EPD - WinPython Download Anaconda from : https://www.anaconda.com/download/ choose your Operating system and python 3.7
  • 7. 7 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  Using Command window: • Open anaconda prompt • Type Python ⏎ (The python command windows is start working)
  • 8. 8 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 • Jupyter Notebook QuickStart: http://jupyter.readthedocs.io/en/latest/content-quickstart.html
  • 9. 9 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/
  • 10. 10 Python Language Python is a programming language, as are C, Fortran, BASIC, PHP, etc. Some specific features of Python are as follows: • an interpreted (as opposed to compiled) language. Python can be used interactively. • a free software released under an open-source license: Python can be used and distributed free of charge, even for building commercial software. • multi-platform: Python is available for all major operating systems. • a very readable language with clear non-verbose syntax • a language for which a large variety of high-quality packages are available for various applications, from web frameworks to scientific computing. • a language very easy to interface with other languages, in particular C and C++. • Some other features of the language are illustrated just below. For example, Python is an object-oriented language, with dynamic typing (the same variable can contain objects of different types during the course of a program).
  • 11. 11 Python Basics • Command Line Window 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. >>> >> x = 9 # assign the value 9 to x
  • 12. 12 Python Variables  A variable is a name that refers to a value.  In Python, No need to declare variables  An assignment statement creates new variables and gives them values.
  • 13. 13 Python Variables (cont.)  Programmers generally choose names for their variables that are meaningful and document what the variable is used for.  Variable names can be arbitrarily long.  They can contain both letters and numbers, but they cannot start with a number.  They can contain underscore character (_).  If you give a variable an illegal name, you get a syntax error.  Python's keywords cannot be used as variable names. Python reserves 33 keywords:
  • 16. 16 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.
  • 17. 17 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.
  • 18. 18 Resources  Scipy Lecture Notes http://www.scipy-lectures.org/  Python for Everybody https://www.py4e.com/  Python official documentation https://docs.python.org  Anaconda web site https://www.anaconda.com