SlideShare a Scribd company logo
1 of 28
Download to read offline
CS.QIAU - Winter 2020
PYTHONIntroduction - Session 0
Omid AmirGhiasvand
Programming
NATURALLANGUAGEConstructed communication tool to convoy meaning
Formal language engineered to communicate instructions to computer
PROGRAMMING LANGUAGE
Programs and Programming Languages
▸ Programs are created using programming languages to control
behaviors and output of a computer through accurate algorithms.
▸ Programming Languages
▸ Machine Language.
▸ Assembly Language.
▸ High-Level Language - More like human language.
▸ Python
▸ Java
▸ GoLang
▸ C++
step by step instruction
to solve a problem
Data Program Result
TRADITIONAL APPROACH TO SOLVE PROBLEM
Program implements an algorithm which is in fact a list of rules
A machine-learning system is trained rather than explicitly
programmed. It’s presented with many examples relevant to a task,
and it finds statistical structure in these examples that eventually
allows the system to come up with rules for automating the task.
NEW APPROACH TO SOLVE PROBLEM
MACHINE LEARNING
Data
ML System Model
Label
Model is an algorithm which is trained by Machine Learning System to solve problem
Program Lifecycle - C++
▸ Editing the Code - Using text editor or IDE
▸ PreProcessing
▸ Compile
▸ Link
▸ Load
▸ Execute
Depend on runtime system and
execution model of the language
Python Program Lifecycle
▸ Behind the scene
.py Python
Compiler
.pyc Python VM
Interpreter
Python byte-codes loaded into Python Runtime
and interpreted by Python Virtual Machine
Byte-code is lower level and
p l a t f o r m i n d e p e n d e n t
presentation of your source code
Building Block of Programming Language
▸ Sequence
▸ The code will run by computer in order - from top to bottom
▸ Decision or Selection - If
▸ The execution of some code only when some condition is true.
▸ Loop or Iteration - For/While
▸ The execution of some code while some condition is true.
Setting Up Your Programming Environment
▸ Python Versions
▸ Python 2 or 3
▸ IDE
▸ PyCharm: A full-fledged IDE
▸ Atom/Sublime and …
▸ Visual Studio Code
▸ You can use any text editor that you like and save your program
with .py extension.
We use -> Python 3.8 and PyCharm 2020
myCode.py
Setup Development Environment
▸ Install Python Interpreter for your Platform (Windows/Mac/Linux)
▸ www.python.org
▸ Add python to your system PATH environment variable
▸ An environment variable is a dynamic named value that can affect the way
running process will behave on a computer.
▸ Install PyCharm
▸ Community
▸ Professional
You can also set PYTHONHOME
Test Development Environment
▸ Open Terminal (CMD in Windows or Terminal in Linux/MAC OS)
▸ python3 - - version
Python
Version
Hello World Project
▸ Open PyCharm.
▸ Create New Project.
▸ Select Pure Python.
▸ Set Location and Name.
▸ Example: CS.QIAU-Python.
▸ Right-Click in Project Folder and Select “New” and Select “Python File”
▸ Set file name.
▸ Example: main.py
▸ Write Code in main.py
▸ Run the Code and Check the output.
Select
Project
Name
Virtual
Environment
Project
Folder
Project
Name and
Folder
main.py in
project root
Code Editor
Windows
main.py
Output
Python
Code
Run
Windows
Break Down the Hello World Program - Simpler Version
▸ Comments - line 1..6
▸ Define main() method - line 9
▸ create welcome_message variable - line 10
▸ call print() method - line 11..13
▸ Check special variable __name__ ==“__main__”
▸ This line of code is the entry point to your program.
▸ Call main() method - line 17
2 underscores
Comments
main()
function
definition
define
and initialize
a string
variable
Print *
print
welcome_message
value
Call
main()
function
Check value of
special variable
__name__
“The Unexamined Life Is Not Worth Living”

More Related Content

What's hot

Cis 355 ilab 1 of 6
Cis 355 ilab 1 of 6Cis 355 ilab 1 of 6
Cis 355 ilab 1 of 6
ashhadiqbal
 
180 daraga cpp course session-1
180 daraga cpp course session-1180 daraga cpp course session-1
180 daraga cpp course session-1
Moustafa Ghoniem
 
Pseudocode-Flowchart
Pseudocode-FlowchartPseudocode-Flowchart
Pseudocode-Flowchart
lotlot
 

What's hot (20)

C language function
C language functionC language function
C language function
 
Modular programming in qbasic
Modular programming in qbasicModular programming in qbasic
Modular programming in qbasic
 
Introduction to Procedural Programming in C++
Introduction to Procedural Programming in C++Introduction to Procedural Programming in C++
Introduction to Procedural Programming in C++
 
structured programming
structured programmingstructured programming
structured programming
 
overview of c#
overview of c#overview of c#
overview of c#
 
Cis 355 ilab 1 of 6
Cis 355 ilab 1 of 6Cis 355 ilab 1 of 6
Cis 355 ilab 1 of 6
 
180 daraga cpp course session-1
180 daraga cpp course session-1180 daraga cpp course session-1
180 daraga cpp course session-1
 
Python - Functions - Azure Jupyter Notebooks
Python - Functions - Azure Jupyter NotebooksPython - Functions - Azure Jupyter Notebooks
Python - Functions - Azure Jupyter Notebooks
 
Lect '1'
Lect '1'Lect '1'
Lect '1'
 
General structure of c++
General structure of c++General structure of c++
General structure of c++
 
Fp201 unit2 1
Fp201 unit2 1Fp201 unit2 1
Fp201 unit2 1
 
Qbasic
QbasicQbasic
Qbasic
 
The Knowledge of QBasic
The Knowledge of QBasicThe Knowledge of QBasic
The Knowledge of QBasic
 
Introduction to QBASIC programming and basics
Introduction to QBASIC programming  and basicsIntroduction to QBASIC programming  and basics
Introduction to QBASIC programming and basics
 
Steps for c program execution
Steps for c program executionSteps for c program execution
Steps for c program execution
 
Pseudocode-Flowchart
Pseudocode-FlowchartPseudocode-Flowchart
Pseudocode-Flowchart
 
A tutorial on C++ Programming
A tutorial on C++ ProgrammingA tutorial on C++ Programming
A tutorial on C++ Programming
 
My first program in c, hello world !
My first program in c, hello world !My first program in c, hello world !
My first program in c, hello world !
 
Scope of variables
Scope of variablesScope of variables
Scope of variables
 
03b loops
03b   loops03b   loops
03b loops
 

Similar to Python Programming - Introduction

Lecture 2 - C Programming.pdf
Lecture 2 - C Programming.pdfLecture 2 - C Programming.pdf
Lecture 2 - C Programming.pdf
ssuser02936f
 

Similar to Python Programming - Introduction (20)

Python Programming for Beginners
Python Programming for BeginnersPython Programming for Beginners
Python Programming for Beginners
 
Lecture01 - Fundamental Programming with Python Language
Lecture01 - Fundamental Programming with Python LanguageLecture01 - Fundamental Programming with Python Language
Lecture01 - Fundamental Programming with Python Language
 
intro.pptx (1).pdf
intro.pptx (1).pdfintro.pptx (1).pdf
intro.pptx (1).pdf
 
Lecture 2 - C Programming.pdf
Lecture 2 - C Programming.pdfLecture 2 - C Programming.pdf
Lecture 2 - C Programming.pdf
 
Ways to generate PDF from Python Web applications, Gaël Le Mignot
Ways to generate PDF from Python Web applications, Gaël Le MignotWays to generate PDF from Python Web applications, Gaël Le Mignot
Ways to generate PDF from Python Web applications, Gaël Le Mignot
 
Mpi.net tutorial
Mpi.net tutorialMpi.net tutorial
Mpi.net tutorial
 
Multiprocessing in python
Multiprocessing in pythonMultiprocessing in python
Multiprocessing in python
 
Python Tutorial | Python Programming Language
Python Tutorial | Python Programming LanguagePython Tutorial | Python Programming Language
Python Tutorial | Python Programming Language
 
Introduction python
Introduction pythonIntroduction python
Introduction python
 
Python for Physical Science.pdf
Python for Physical Science.pdfPython for Physical Science.pdf
Python for Physical Science.pdf
 
BSides Iowa 2018: Windows COM: Red vs Blue
BSides Iowa 2018: Windows COM: Red vs BlueBSides Iowa 2018: Windows COM: Red vs Blue
BSides Iowa 2018: Windows COM: Red vs Blue
 
C++Basics2022.pptx
C++Basics2022.pptxC++Basics2022.pptx
C++Basics2022.pptx
 
Introduction to Google App Engine with Python
Introduction to Google App Engine with PythonIntroduction to Google App Engine with Python
Introduction to Google App Engine with Python
 
Fundamentals of programming with C++
Fundamentals of programming with C++Fundamentals of programming with C++
Fundamentals of programming with C++
 
Introduction to python for Beginners
Introduction to python for Beginners Introduction to python for Beginners
Introduction to python for Beginners
 
Pyhton-1a-Basics.pdf
Pyhton-1a-Basics.pdfPyhton-1a-Basics.pdf
Pyhton-1a-Basics.pdf
 
C++ book
C++ bookC++ book
C++ book
 
Lecture01
Lecture01Lecture01
Lecture01
 
The Best Feature of Go – A 5 Year Retrospective
The Best Feature of Go – A 5 Year RetrospectiveThe Best Feature of Go – A 5 Year Retrospective
The Best Feature of Go – A 5 Year Retrospective
 
Python tutorial for beginners - Tib academy
Python tutorial for beginners - Tib academyPython tutorial for beginners - Tib academy
Python tutorial for beginners - Tib academy
 

Recently uploaded

The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Recently uploaded (20)

The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
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
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxBUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
 
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
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
ManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide DeckManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide Deck
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 

Python Programming - Introduction

  • 1. CS.QIAU - Winter 2020 PYTHONIntroduction - Session 0 Omid AmirGhiasvand Programming
  • 3. Formal language engineered to communicate instructions to computer PROGRAMMING LANGUAGE
  • 4. Programs and Programming Languages ▸ Programs are created using programming languages to control behaviors and output of a computer through accurate algorithms. ▸ Programming Languages ▸ Machine Language. ▸ Assembly Language. ▸ High-Level Language - More like human language. ▸ Python ▸ Java ▸ GoLang ▸ C++ step by step instruction to solve a problem
  • 5. Data Program Result TRADITIONAL APPROACH TO SOLVE PROBLEM Program implements an algorithm which is in fact a list of rules
  • 6. A machine-learning system is trained rather than explicitly programmed. It’s presented with many examples relevant to a task, and it finds statistical structure in these examples that eventually allows the system to come up with rules for automating the task. NEW APPROACH TO SOLVE PROBLEM MACHINE LEARNING
  • 7. Data ML System Model Label Model is an algorithm which is trained by Machine Learning System to solve problem
  • 8. Program Lifecycle - C++ ▸ Editing the Code - Using text editor or IDE ▸ PreProcessing ▸ Compile ▸ Link ▸ Load ▸ Execute Depend on runtime system and execution model of the language
  • 9. Python Program Lifecycle ▸ Behind the scene .py Python Compiler .pyc Python VM Interpreter Python byte-codes loaded into Python Runtime and interpreted by Python Virtual Machine Byte-code is lower level and p l a t f o r m i n d e p e n d e n t presentation of your source code
  • 10. Building Block of Programming Language ▸ Sequence ▸ The code will run by computer in order - from top to bottom ▸ Decision or Selection - If ▸ The execution of some code only when some condition is true. ▸ Loop or Iteration - For/While ▸ The execution of some code while some condition is true.
  • 11. Setting Up Your Programming Environment ▸ Python Versions ▸ Python 2 or 3 ▸ IDE ▸ PyCharm: A full-fledged IDE ▸ Atom/Sublime and … ▸ Visual Studio Code ▸ You can use any text editor that you like and save your program with .py extension. We use -> Python 3.8 and PyCharm 2020 myCode.py
  • 12. Setup Development Environment ▸ Install Python Interpreter for your Platform (Windows/Mac/Linux) ▸ www.python.org ▸ Add python to your system PATH environment variable ▸ An environment variable is a dynamic named value that can affect the way running process will behave on a computer. ▸ Install PyCharm ▸ Community ▸ Professional You can also set PYTHONHOME
  • 13.
  • 14. Test Development Environment ▸ Open Terminal (CMD in Windows or Terminal in Linux/MAC OS) ▸ python3 - - version Python Version
  • 15. Hello World Project ▸ Open PyCharm. ▸ Create New Project. ▸ Select Pure Python. ▸ Set Location and Name. ▸ Example: CS.QIAU-Python. ▸ Right-Click in Project Folder and Select “New” and Select “Python File” ▸ Set file name. ▸ Example: main.py ▸ Write Code in main.py ▸ Run the Code and Check the output.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25. Project Name and Folder main.py in project root Code Editor Windows main.py Output Python Code Run Windows
  • 26. Break Down the Hello World Program - Simpler Version ▸ Comments - line 1..6 ▸ Define main() method - line 9 ▸ create welcome_message variable - line 10 ▸ call print() method - line 11..13 ▸ Check special variable __name__ ==“__main__” ▸ This line of code is the entry point to your program. ▸ Call main() method - line 17 2 underscores
  • 27. Comments main() function definition define and initialize a string variable Print * print welcome_message value Call main() function Check value of special variable __name__
  • 28. “The Unexamined Life Is Not Worth Living”