SlideShare a Scribd company logo
Welcometo Python Course Basic
Naiyan Noor
BSc inCSE
BangladeshArmyUniversityofScienceandTechnology-BAUST
A snake.
A British comedy group called MontyPython.
A programming languge. Thedefinition of the language:words, punctuation (operators)
and grammar(syntax).
Thecompiler/interpreterof the Pythonprogramminglanguage. (aka. CPython).
What is Python?
Aneditor wherewe canwrite ina language.
A compiler or interpreterthat can translate our text to the language of the
computer.
What is needed to write a program?
Python2.x -old, legacy code at companies, answers onthe Internet. Retires on
January1,2020.
Python3.x -the one that youshould use. (not fully backward compatible)
Available since December 3, 2008.
Python 2 vs. Python 3.
Microsoft Windows
Installation
Linux
MacOS
We aregoingtocover howtoinstallPythonall3majoroperatingsystems.
Anaconda with Python3.x
Anaconda shell
Anaconda Jupyternotebook
Installation on Microsoft Windows
Basically youcan use anytext editor to write Pythoncode. TheminimumI
recommendis to haveproper syntax highlighting. IDEs will also provide
intellisense, that is, inmost of the cases they will be able to understand what
kindof objects do youhavein yourcode and will beable to show youthe
available methods and theirparameters. Even better, theyprovide powerful
debuggers.
Editors, IDEs
Emacs
vi,vim,gvim
spf13-vim
Kate
Gedit
jEdit”
Editors IDE Linux ,Windows or Mac
Notepad++
Textpad
UltraEdit
Linux Windows Mac
CotEditor
TextWrangler
TextMate
Type“texteditor”inyour
AppleStore(filtertofree)
PyCharmcommunity edition
Visual Codeof Microsoft
Spyder, a scientific environment (included in Anaconda)
Jupyter with IPython behind the scene.
IDLE(comes with Python)
KomodoofActiveState
Aptana
Pyscripter
PyDev(for Eclipse)
Wing IDE
IDEs
More or less theonly thing I do on thecommand line with pythonis to checkthe
version number:
Python on the command line
1 python -V
2 python --version
Youcan runsome Pythoncode without creating a file, but I don’t rememeber
ever needing this. If you insists
Python on the command line
1python-c "print 42"
1 python3 -c"print(42)"
Typethe following to get thedetails:
1man python
cmdline
Createa file called hello.py with the above content.
Open yourterminal or the Anaconda Prompt on MS Windows inthe directory
(folder)
Changeto thedirectory whereyousaved the file.
Runit by typing python hello.py or python3hello.py
Theextension is .py-mostly for the editor (but also for modules).
Parentheses after print() are required in Python3, but usethem evenif youare
stuck onPython 2.
First script - hello world
1print("hello")
2
3 # Comments for other developers
4
5print("world") # morecomments
6
7 # print("Thisis not printed")
Comments
1 greeting = "Hello World!"
2 print(greeting)”
Variables
Exercise: Hello world)
Tryyourenvironment:
Makesure you haveaccess to the right version of Python.
Install Pythonif needed.
What is programming?
Use some language totell the computer what todo.
Like a cooking recepie it has step-by-stepinstructions.
Taking acomplex problemand dividing it into small steps acomputer can
do.
What are the programming languages
A computer CPUis createdfrom transistors, 1and 0 values. (aka. bits)
Its language consists of numbers. (e.g 37 means move the content of ax
register to bxregister)
English? too complex, toomuch ambiguity.
Programming languages are in-beteen.
A programming language
Built-in words: print, len, type,def,…
Literal values: numbers, strings
Operators:+ - * = , ; …
Grammar (syntax)
User-createdwords: variables, functions, classes, ….
Words and punctuation matter!
What did you chose? (Correctly:choose, but people will usually
understand.)
Lets do the homework. (Correctly:Let’s, but most people will understand.)
Let’s eat, grandpa!
Let’s eat grandpa!
Words and punctuation matter!
Whatdid you chose? (Correctly:choose, butpeoplewill usuallyunderstand.)
Letsdo thehomework.(Correctly:Let’s,butmostpeoplewill understand.)
Let’seat,grandpa!
Let’seatgrandpa!
Programminglanguageshavea lotlesswords,buttheyarevery stricton thegrammar(syntax).
Amising comma can breakyour code.
Amissing space willchange themeaningof your code.
Anincorreectwordcan ruinyour day.
Literals, Value Types in Python
“ 1print(type(23) ) #int
2 print(type(3.14) ) #float
3 print(type("hello")) #str
4
5 print(type("23") ) #str
6 print(type("3.24") ) #str
7
8 print(type(None)) #NoneType
9 print(type(True)) #bool
10 print(type(False) ) #bool
11
12 print(type([])) # list
13 print(type({})) # dict
14
15 print(type(hello)) # NameError:name'hello' is notdefined
16 print("Stillrunning")
Multiply string
1width= "23"
2height= "17"
3area= width*height
4print(area)
1Traceback(most recentcall last):
2 File"python/examples/basics/rectangular_strings.py",line3, in<module>
3 area=width*height
4 TypeError:can't multiplysequence by non-intof type 'str”
Add numbers
“1a =19
2b= 23
3c =a + b
4print(c) #42”
Add numbers & Add strings
“1a = 19
2 b = 23
3 c = a + b
4 print(c) # 42”
1 a = "19"
2 b = "23"
3 c = a + b
4 print(c) # 1923
Numbers Strings
Exercise: Calculations
“Extend the rectangular_basic.py from above to print both the area and the
circumferenceof the rectangle.
Write a script that has a variable holding the radius of a circleand prints out the area
of the circleand the circumferenceof the circle.
Write a script that has two numbers a and b and prints out the results of a+b, a-b,
a*b, a/b”
Solution: Calculations
1a =19
2b = 23
3c= a + b
4prin“1width = 23
2height= 17
3area = width *height
4print("The area is", area) # 391
5circumference = 2*(width + height)
6print("The circumference is", circumference) # 80
1r= 7
2pi= 3.14
3print("The area is", r* r* pi) # 153.86
4print("The circumference is", 2* r* pi) # 43.96
Solution: Calculations
1importmath
2
3r= 7
4print("The area is", r* r* math.pi) # 153.9380400258998
5print("The circumference is", 2* r* math.pi) # 43.982297150257104
1a =3
2b = 2
3
4print(a+b) # 5
5print(a-b) # 1
“6print(a*b) # 6
7print(a/b) # 1.5”
Solution: Calculations
1importmath
2
3r= 7
4print("The area is", r* r* math.pi) # 153.9380400258998
5print("The circumference is", 2* r* math.pi) # 43.982297150257104
1a =3
2b = 2
3
4print(a+b) # 5
5print(a-b) # 1
“6print(a*b) # 6
7print(a/b) # 1.5”
Thank You.

More Related Content

What's hot

Deep learning introduction
Deep learning introductionDeep learning introduction
Deep learning introduction
Adwait Bhave
 
Implementation of humanoid robot with using the
Implementation of humanoid robot with using theImplementation of humanoid robot with using the
Implementation of humanoid robot with using the
eSAT Publishing House
 
Implementation of humanoid robot with using the concept of synthetic brain
Implementation of humanoid robot with using the concept of synthetic brainImplementation of humanoid robot with using the concept of synthetic brain
Implementation of humanoid robot with using the concept of synthetic brain
eSAT Journals
 
Step Into World of Artificial Intelligence
Step Into World of Artificial IntelligenceStep Into World of Artificial Intelligence
Step Into World of Artificial Intelligence
Explore Skilled
 
Intelligence and artificial intelligence
Intelligence and artificial intelligenceIntelligence and artificial intelligence
Intelligence and artificial intelligence
Dr. Uday Saikia
 
Deep learning short introduction
Deep learning short introductionDeep learning short introduction
Deep learning short introduction
Adwait Bhave
 
Artificial intelligence Presentation.pptx
Artificial intelligence Presentation.pptxArtificial intelligence Presentation.pptx
Artificial intelligence Presentation.pptx
Abdullah al Mamun
 
Artificial intelligence samrat tayade
Artificial intelligence samrat tayadeArtificial intelligence samrat tayade
Artificial intelligence samrat tayade
Samrat Tayade
 
ARTIFICIAL INTELLIGENCE
ARTIFICIAL INTELLIGENCEARTIFICIAL INTELLIGENCE
ARTIFICIAL INTELLIGENCE
HANISHTHARWANI21BCE1
 
Sprint 1
Sprint 1Sprint 1
Sprint 1
sudip sapkota
 
Everything you need to know about chatbots
Everything you need to know about chatbotsEverything you need to know about chatbots
Everything you need to know about chatbots
Konstant Infosolutions Pvt. Ltd.
 
Ai &amp; machine learning win sple
Ai &amp; machine learning   win spleAi &amp; machine learning   win sple
Ai &amp; machine learning win sple
LewisWhite16
 
Artificial intelligence
Artificial intelligenceArtificial intelligence
Artificial intelligenceyham manansala
 
Ml basics
Ml basicsMl basics
Ml basics
CourseHunt
 
Iaetsd artificial intelligence
Iaetsd artificial intelligenceIaetsd artificial intelligence
Iaetsd artificial intelligence
Iaetsd Iaetsd
 
Machine learning in startup
Machine learning in startupMachine learning in startup
Machine learning in startup
Masas Dani
 
HKOSCon18 - Chetan Khatri - Open Source AI / ML Technologies and Application ...
HKOSCon18 - Chetan Khatri - Open Source AI / ML Technologies and Application ...HKOSCon18 - Chetan Khatri - Open Source AI / ML Technologies and Application ...
HKOSCon18 - Chetan Khatri - Open Source AI / ML Technologies and Application ...
Chetan Khatri
 
What Is Machine Learning? | What Is Machine Learning And How Does It Work? | ...
What Is Machine Learning? | What Is Machine Learning And How Does It Work? | ...What Is Machine Learning? | What Is Machine Learning And How Does It Work? | ...
What Is Machine Learning? | What Is Machine Learning And How Does It Work? | ...
Simplilearn
 
Software 2.0 - a Babel fish for deep learning
Software 2.0 - a Babel fish for deep learningSoftware 2.0 - a Babel fish for deep learning
Software 2.0 - a Babel fish for deep learning
Olivier Wulveryck
 
Artificial intelligency full_ppt_persentation_way2project_in
Artificial intelligency full_ppt_persentation_way2project_inArtificial intelligency full_ppt_persentation_way2project_in
Artificial intelligency full_ppt_persentation_way2project_inSumit Sharma
 

What's hot (20)

Deep learning introduction
Deep learning introductionDeep learning introduction
Deep learning introduction
 
Implementation of humanoid robot with using the
Implementation of humanoid robot with using theImplementation of humanoid robot with using the
Implementation of humanoid robot with using the
 
Implementation of humanoid robot with using the concept of synthetic brain
Implementation of humanoid robot with using the concept of synthetic brainImplementation of humanoid robot with using the concept of synthetic brain
Implementation of humanoid robot with using the concept of synthetic brain
 
Step Into World of Artificial Intelligence
Step Into World of Artificial IntelligenceStep Into World of Artificial Intelligence
Step Into World of Artificial Intelligence
 
Intelligence and artificial intelligence
Intelligence and artificial intelligenceIntelligence and artificial intelligence
Intelligence and artificial intelligence
 
Deep learning short introduction
Deep learning short introductionDeep learning short introduction
Deep learning short introduction
 
Artificial intelligence Presentation.pptx
Artificial intelligence Presentation.pptxArtificial intelligence Presentation.pptx
Artificial intelligence Presentation.pptx
 
Artificial intelligence samrat tayade
Artificial intelligence samrat tayadeArtificial intelligence samrat tayade
Artificial intelligence samrat tayade
 
ARTIFICIAL INTELLIGENCE
ARTIFICIAL INTELLIGENCEARTIFICIAL INTELLIGENCE
ARTIFICIAL INTELLIGENCE
 
Sprint 1
Sprint 1Sprint 1
Sprint 1
 
Everything you need to know about chatbots
Everything you need to know about chatbotsEverything you need to know about chatbots
Everything you need to know about chatbots
 
Ai &amp; machine learning win sple
Ai &amp; machine learning   win spleAi &amp; machine learning   win sple
Ai &amp; machine learning win sple
 
Artificial intelligence
Artificial intelligenceArtificial intelligence
Artificial intelligence
 
Ml basics
Ml basicsMl basics
Ml basics
 
Iaetsd artificial intelligence
Iaetsd artificial intelligenceIaetsd artificial intelligence
Iaetsd artificial intelligence
 
Machine learning in startup
Machine learning in startupMachine learning in startup
Machine learning in startup
 
HKOSCon18 - Chetan Khatri - Open Source AI / ML Technologies and Application ...
HKOSCon18 - Chetan Khatri - Open Source AI / ML Technologies and Application ...HKOSCon18 - Chetan Khatri - Open Source AI / ML Technologies and Application ...
HKOSCon18 - Chetan Khatri - Open Source AI / ML Technologies and Application ...
 
What Is Machine Learning? | What Is Machine Learning And How Does It Work? | ...
What Is Machine Learning? | What Is Machine Learning And How Does It Work? | ...What Is Machine Learning? | What Is Machine Learning And How Does It Work? | ...
What Is Machine Learning? | What Is Machine Learning And How Does It Work? | ...
 
Software 2.0 - a Babel fish for deep learning
Software 2.0 - a Babel fish for deep learningSoftware 2.0 - a Babel fish for deep learning
Software 2.0 - a Babel fish for deep learning
 
Artificial intelligency full_ppt_persentation_way2project_in
Artificial intelligency full_ppt_persentation_way2project_inArtificial intelligency full_ppt_persentation_way2project_in
Artificial intelligency full_ppt_persentation_way2project_in
 

Similar to Python Course Basic

slides1-introduction to python-programming.pptx
slides1-introduction to python-programming.pptxslides1-introduction to python-programming.pptx
slides1-introduction to python-programming.pptx
AkhdanMumtaz
 
unit (1)INTRODUCTION TO PYTHON course.pptx
unit (1)INTRODUCTION TO PYTHON course.pptxunit (1)INTRODUCTION TO PYTHON course.pptx
unit (1)INTRODUCTION TO PYTHON course.pptx
usvirat1805
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to pythonmckennadglyn
 
Introduction to python.pptx
Introduction to python.pptxIntroduction to python.pptx
Introduction to python.pptx
pcjoshi02
 
python presentation
python presentationpython presentation
python presentation
VaibhavMawal
 
Python and Pytorch tutorial and walkthrough
Python and Pytorch tutorial and walkthroughPython and Pytorch tutorial and walkthrough
Python and Pytorch tutorial and walkthrough
gabriellekuruvilla
 
05 python.pdf
05 python.pdf05 python.pdf
05 python.pdf
SugumarSarDurai
 
Python introduction towards data science
Python introduction towards data sciencePython introduction towards data science
Python introduction towards data science
deepak teja
 
UNIT-1 : 20ACS04 – PROBLEM SOLVING AND PROGRAMMING USING PYTHON
UNIT-1 : 20ACS04 – PROBLEM SOLVING AND PROGRAMMING USING PYTHON UNIT-1 : 20ACS04 – PROBLEM SOLVING AND PROGRAMMING USING PYTHON
UNIT-1 : 20ACS04 – PROBLEM SOLVING AND PROGRAMMING USING PYTHON
Nandakumar P
 
Chapter01_Python.ppt
Chapter01_Python.pptChapter01_Python.ppt
Chapter01_Python.ppt
PigPug1
 
python-160403194316.pdf
python-160403194316.pdfpython-160403194316.pdf
python-160403194316.pdf
gmadhu8
 
Chapter - 1.pptx
Chapter - 1.pptxChapter - 1.pptx
Chapter - 1.pptx
MikialeTesfamariam
 
python into.pptx
python into.pptxpython into.pptx
python into.pptx
Punithavel Ramani
 
python lab programs.pdf
python lab programs.pdfpython lab programs.pdf
python lab programs.pdf
CBJWorld
 
Python Seminar PPT
Python Seminar PPTPython Seminar PPT
Python Seminar PPT
Shivam Gupta
 
Python
PythonPython
Python
Shivam Gupta
 
Python PPT1.pdf
Python PPT1.pdfPython PPT1.pdf
Python PPT1.pdf
DrSSelvakanmaniAssoc
 
PYTHON PROGRAMMING NOTES RKREDDY.pdf
PYTHON PROGRAMMING NOTES RKREDDY.pdfPYTHON PROGRAMMING NOTES RKREDDY.pdf
PYTHON PROGRAMMING NOTES RKREDDY.pdf
Ramakrishna Reddy Bijjam
 
Python fundamentals
Python fundamentalsPython fundamentals
Python fundamentals
natnaelmamuye
 

Similar to Python Course Basic (20)

slides1-introduction to python-programming.pptx
slides1-introduction to python-programming.pptxslides1-introduction to python-programming.pptx
slides1-introduction to python-programming.pptx
 
unit (1)INTRODUCTION TO PYTHON course.pptx
unit (1)INTRODUCTION TO PYTHON course.pptxunit (1)INTRODUCTION TO PYTHON course.pptx
unit (1)INTRODUCTION TO PYTHON course.pptx
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
Introduction to python.pptx
Introduction to python.pptxIntroduction to python.pptx
Introduction to python.pptx
 
python presentation
python presentationpython presentation
python presentation
 
Python and Pytorch tutorial and walkthrough
Python and Pytorch tutorial and walkthroughPython and Pytorch tutorial and walkthrough
Python and Pytorch tutorial and walkthrough
 
05 python.pdf
05 python.pdf05 python.pdf
05 python.pdf
 
Python introduction towards data science
Python introduction towards data sciencePython introduction towards data science
Python introduction towards data science
 
UNIT-1 : 20ACS04 – PROBLEM SOLVING AND PROGRAMMING USING PYTHON
UNIT-1 : 20ACS04 – PROBLEM SOLVING AND PROGRAMMING USING PYTHON UNIT-1 : 20ACS04 – PROBLEM SOLVING AND PROGRAMMING USING PYTHON
UNIT-1 : 20ACS04 – PROBLEM SOLVING AND PROGRAMMING USING PYTHON
 
Chapter01_Python.ppt
Chapter01_Python.pptChapter01_Python.ppt
Chapter01_Python.ppt
 
python-160403194316.pdf
python-160403194316.pdfpython-160403194316.pdf
python-160403194316.pdf
 
Chapter - 1.pptx
Chapter - 1.pptxChapter - 1.pptx
Chapter - 1.pptx
 
python into.pptx
python into.pptxpython into.pptx
python into.pptx
 
python lab programs.pdf
python lab programs.pdfpython lab programs.pdf
python lab programs.pdf
 
Python Seminar PPT
Python Seminar PPTPython Seminar PPT
Python Seminar PPT
 
Python
PythonPython
Python
 
Python PPT1.pdf
Python PPT1.pdfPython PPT1.pdf
Python PPT1.pdf
 
PYTHON PROGRAMMING NOTES RKREDDY.pdf
PYTHON PROGRAMMING NOTES RKREDDY.pdfPYTHON PROGRAMMING NOTES RKREDDY.pdf
PYTHON PROGRAMMING NOTES RKREDDY.pdf
 
Python fundamentals
Python fundamentalsPython fundamentals
Python fundamentals
 
Learn python
Learn pythonLearn python
Learn python
 

More from Naiyan Noor

Diploma in Computer Science and ICT.pdf
Diploma in Computer Science and ICT.pdfDiploma in Computer Science and ICT.pdf
Diploma in Computer Science and ICT.pdf
Naiyan Noor
 
Advanced Learning Algorithms.pdf
Advanced Learning Algorithms.pdfAdvanced Learning Algorithms.pdf
Advanced Learning Algorithms.pdf
Naiyan Noor
 
HTML and CSS in depth.pdf
HTML and CSS in depth.pdfHTML and CSS in depth.pdf
HTML and CSS in depth.pdf
Naiyan Noor
 
Skills Development for Mobile Game and Application Project..Naiyan noor
Skills Development for Mobile Game and Application Project..Naiyan noorSkills Development for Mobile Game and Application Project..Naiyan noor
Skills Development for Mobile Game and Application Project..Naiyan noor
Naiyan Noor
 
English for Career Development Naiyan Noor.pdf
English for Career Development Naiyan Noor.pdfEnglish for Career Development Naiyan Noor.pdf
English for Career Development Naiyan Noor.pdf
Naiyan Noor
 
Data Visualization with Python.....Naiyan Noor.pdf
Data Visualization with Python.....Naiyan Noor.pdfData Visualization with Python.....Naiyan Noor.pdf
Data Visualization with Python.....Naiyan Noor.pdf
Naiyan Noor
 
Databases and SQL for Data Science with Python...Naiyan Noor.pdf
Databases and SQL for Data Science with Python...Naiyan Noor.pdfDatabases and SQL for Data Science with Python...Naiyan Noor.pdf
Databases and SQL for Data Science with Python...Naiyan Noor.pdf
Naiyan Noor
 
Data Science Methodology...Naiyan Noor.pdf
Data Science Methodology...Naiyan Noor.pdfData Science Methodology...Naiyan Noor.pdf
Data Science Methodology...Naiyan Noor.pdf
Naiyan Noor
 
Tools for Data Science ...Naiyan Noor.pdf
Tools for Data Science ...Naiyan Noor.pdfTools for Data Science ...Naiyan Noor.pdf
Tools for Data Science ...Naiyan Noor.pdf
Naiyan Noor
 
What is Data Science? ... Naiyan Noor.pdf
What is Data Science? ... Naiyan Noor.pdfWhat is Data Science? ... Naiyan Noor.pdf
What is Data Science? ... Naiyan Noor.pdf
Naiyan Noor
 
Programming for Everybody (Getting Started with Python)...Naiyan Noor.pdf
Programming for Everybody (Getting Started with Python)...Naiyan Noor.pdfProgramming for Everybody (Getting Started with Python)...Naiyan Noor.pdf
Programming for Everybody (Getting Started with Python)...Naiyan Noor.pdf
Naiyan Noor
 
HTML, CSS, and Javascript for Web Developers ...Naiyan Noor.pdf
HTML, CSS, and Javascript for Web Developers ...Naiyan Noor.pdfHTML, CSS, and Javascript for Web Developers ...Naiyan Noor.pdf
HTML, CSS, and Javascript for Web Developers ...Naiyan Noor.pdf
Naiyan Noor
 
Introduction to Data Science Naiyan Noor.pdf
Introduction to Data Science Naiyan Noor.pdfIntroduction to Data Science Naiyan Noor.pdf
Introduction to Data Science Naiyan Noor.pdf
Naiyan Noor
 
Coursera Programming Foundations with JavaScript, HTML and CSS ....Naiyan Noo...
Coursera Programming Foundations with JavaScript, HTML and CSS ....Naiyan Noo...Coursera Programming Foundations with JavaScript, HTML and CSS ....Naiyan Noo...
Coursera Programming Foundations with JavaScript, HTML and CSS ....Naiyan Noo...
Naiyan Noor
 
Social Media Marketing powered by HP....Naiyan Noor.pdf
Social Media Marketing powered by HP....Naiyan Noor.pdfSocial Media Marketing powered by HP....Naiyan Noor.pdf
Social Media Marketing powered by HP....Naiyan Noor.pdf
Naiyan Noor
 
Motor Driving Training with Basic Maintenance. SEIP ..Naiyan Noor.pdf
Motor Driving Training with Basic Maintenance. SEIP  ..Naiyan Noor.pdfMotor Driving Training with Basic Maintenance. SEIP  ..Naiyan Noor.pdf
Motor Driving Training with Basic Maintenance. SEIP ..Naiyan Noor.pdf
Naiyan Noor
 
Web Application Development using PHP and Laravel -Naiyan Noor .pdf
Web Application Development using PHP and Laravel -Naiyan Noor .pdfWeb Application Development using PHP and Laravel -Naiyan Noor .pdf
Web Application Development using PHP and Laravel -Naiyan Noor .pdf
Naiyan Noor
 
Linux Presentation
Linux PresentationLinux Presentation
Linux Presentation
Naiyan Noor
 
UQx ieltsx certificate | edX
UQx ieltsx certificate | edXUQx ieltsx certificate | edX
UQx ieltsx certificate | edX
Naiyan Noor
 
Using Python for Research-HarvardX
Using Python for Research-HarvardX Using Python for Research-HarvardX
Using Python for Research-HarvardX
Naiyan Noor
 

More from Naiyan Noor (20)

Diploma in Computer Science and ICT.pdf
Diploma in Computer Science and ICT.pdfDiploma in Computer Science and ICT.pdf
Diploma in Computer Science and ICT.pdf
 
Advanced Learning Algorithms.pdf
Advanced Learning Algorithms.pdfAdvanced Learning Algorithms.pdf
Advanced Learning Algorithms.pdf
 
HTML and CSS in depth.pdf
HTML and CSS in depth.pdfHTML and CSS in depth.pdf
HTML and CSS in depth.pdf
 
Skills Development for Mobile Game and Application Project..Naiyan noor
Skills Development for Mobile Game and Application Project..Naiyan noorSkills Development for Mobile Game and Application Project..Naiyan noor
Skills Development for Mobile Game and Application Project..Naiyan noor
 
English for Career Development Naiyan Noor.pdf
English for Career Development Naiyan Noor.pdfEnglish for Career Development Naiyan Noor.pdf
English for Career Development Naiyan Noor.pdf
 
Data Visualization with Python.....Naiyan Noor.pdf
Data Visualization with Python.....Naiyan Noor.pdfData Visualization with Python.....Naiyan Noor.pdf
Data Visualization with Python.....Naiyan Noor.pdf
 
Databases and SQL for Data Science with Python...Naiyan Noor.pdf
Databases and SQL for Data Science with Python...Naiyan Noor.pdfDatabases and SQL for Data Science with Python...Naiyan Noor.pdf
Databases and SQL for Data Science with Python...Naiyan Noor.pdf
 
Data Science Methodology...Naiyan Noor.pdf
Data Science Methodology...Naiyan Noor.pdfData Science Methodology...Naiyan Noor.pdf
Data Science Methodology...Naiyan Noor.pdf
 
Tools for Data Science ...Naiyan Noor.pdf
Tools for Data Science ...Naiyan Noor.pdfTools for Data Science ...Naiyan Noor.pdf
Tools for Data Science ...Naiyan Noor.pdf
 
What is Data Science? ... Naiyan Noor.pdf
What is Data Science? ... Naiyan Noor.pdfWhat is Data Science? ... Naiyan Noor.pdf
What is Data Science? ... Naiyan Noor.pdf
 
Programming for Everybody (Getting Started with Python)...Naiyan Noor.pdf
Programming for Everybody (Getting Started with Python)...Naiyan Noor.pdfProgramming for Everybody (Getting Started with Python)...Naiyan Noor.pdf
Programming for Everybody (Getting Started with Python)...Naiyan Noor.pdf
 
HTML, CSS, and Javascript for Web Developers ...Naiyan Noor.pdf
HTML, CSS, and Javascript for Web Developers ...Naiyan Noor.pdfHTML, CSS, and Javascript for Web Developers ...Naiyan Noor.pdf
HTML, CSS, and Javascript for Web Developers ...Naiyan Noor.pdf
 
Introduction to Data Science Naiyan Noor.pdf
Introduction to Data Science Naiyan Noor.pdfIntroduction to Data Science Naiyan Noor.pdf
Introduction to Data Science Naiyan Noor.pdf
 
Coursera Programming Foundations with JavaScript, HTML and CSS ....Naiyan Noo...
Coursera Programming Foundations with JavaScript, HTML and CSS ....Naiyan Noo...Coursera Programming Foundations with JavaScript, HTML and CSS ....Naiyan Noo...
Coursera Programming Foundations with JavaScript, HTML and CSS ....Naiyan Noo...
 
Social Media Marketing powered by HP....Naiyan Noor.pdf
Social Media Marketing powered by HP....Naiyan Noor.pdfSocial Media Marketing powered by HP....Naiyan Noor.pdf
Social Media Marketing powered by HP....Naiyan Noor.pdf
 
Motor Driving Training with Basic Maintenance. SEIP ..Naiyan Noor.pdf
Motor Driving Training with Basic Maintenance. SEIP  ..Naiyan Noor.pdfMotor Driving Training with Basic Maintenance. SEIP  ..Naiyan Noor.pdf
Motor Driving Training with Basic Maintenance. SEIP ..Naiyan Noor.pdf
 
Web Application Development using PHP and Laravel -Naiyan Noor .pdf
Web Application Development using PHP and Laravel -Naiyan Noor .pdfWeb Application Development using PHP and Laravel -Naiyan Noor .pdf
Web Application Development using PHP and Laravel -Naiyan Noor .pdf
 
Linux Presentation
Linux PresentationLinux Presentation
Linux Presentation
 
UQx ieltsx certificate | edX
UQx ieltsx certificate | edXUQx ieltsx certificate | edX
UQx ieltsx certificate | edX
 
Using Python for Research-HarvardX
Using Python for Research-HarvardX Using Python for Research-HarvardX
Using Python for Research-HarvardX
 

Recently uploaded

Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
MdTanvirMahtab2
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
Kamal Acharya
 
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming PipelinesHarnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Christina Lin
 
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
ssuser7dcef0
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
bakpo1
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Sreedhar Chowdam
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Dr.Costas Sachpazis
 
14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application
SyedAbiiAzazi1
 
Building Electrical System Design & Installation
Building Electrical System Design & InstallationBuilding Electrical System Design & Installation
Building Electrical System Design & Installation
symbo111
 
Technical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prismsTechnical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prisms
heavyhaig
 
The Role of Electrical and Electronics Engineers in IOT Technology.pdf
The Role of Electrical and Electronics Engineers in IOT Technology.pdfThe Role of Electrical and Electronics Engineers in IOT Technology.pdf
The Role of Electrical and Electronics Engineers in IOT Technology.pdf
Nettur Technical Training Foundation
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
fxintegritypublishin
 
Fundamentals of Induction Motor Drives.pptx
Fundamentals of Induction Motor Drives.pptxFundamentals of Induction Motor Drives.pptx
Fundamentals of Induction Motor Drives.pptx
manasideore6
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
VENKATESHvenky89705
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
Amil Baba Dawood bangali
 
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTSHeap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Soumen Santra
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
gdsczhcet
 
PPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testingPPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testing
anoopmanoharan2
 
Forklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella PartsForklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella Parts
Intella Parts
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
gerogepatton
 

Recently uploaded (20)

Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
 
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming PipelinesHarnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
 
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
 
14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application
 
Building Electrical System Design & Installation
Building Electrical System Design & InstallationBuilding Electrical System Design & Installation
Building Electrical System Design & Installation
 
Technical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prismsTechnical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prisms
 
The Role of Electrical and Electronics Engineers in IOT Technology.pdf
The Role of Electrical and Electronics Engineers in IOT Technology.pdfThe Role of Electrical and Electronics Engineers in IOT Technology.pdf
The Role of Electrical and Electronics Engineers in IOT Technology.pdf
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
 
Fundamentals of Induction Motor Drives.pptx
Fundamentals of Induction Motor Drives.pptxFundamentals of Induction Motor Drives.pptx
Fundamentals of Induction Motor Drives.pptx
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
 
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTSHeap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
 
PPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testingPPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testing
 
Forklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella PartsForklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella Parts
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
 

Python Course Basic

  • 1. Welcometo Python Course Basic Naiyan Noor BSc inCSE BangladeshArmyUniversityofScienceandTechnology-BAUST
  • 2. A snake. A British comedy group called MontyPython. A programming languge. Thedefinition of the language:words, punctuation (operators) and grammar(syntax). Thecompiler/interpreterof the Pythonprogramminglanguage. (aka. CPython). What is Python?
  • 3. Aneditor wherewe canwrite ina language. A compiler or interpreterthat can translate our text to the language of the computer. What is needed to write a program?
  • 4. Python2.x -old, legacy code at companies, answers onthe Internet. Retires on January1,2020. Python3.x -the one that youshould use. (not fully backward compatible) Available since December 3, 2008. Python 2 vs. Python 3.
  • 5. Microsoft Windows Installation Linux MacOS We aregoingtocover howtoinstallPythonall3majoroperatingsystems.
  • 6. Anaconda with Python3.x Anaconda shell Anaconda Jupyternotebook Installation on Microsoft Windows
  • 7. Basically youcan use anytext editor to write Pythoncode. TheminimumI recommendis to haveproper syntax highlighting. IDEs will also provide intellisense, that is, inmost of the cases they will be able to understand what kindof objects do youhavein yourcode and will beable to show youthe available methods and theirparameters. Even better, theyprovide powerful debuggers. Editors, IDEs
  • 8. Emacs vi,vim,gvim spf13-vim Kate Gedit jEdit” Editors IDE Linux ,Windows or Mac Notepad++ Textpad UltraEdit Linux Windows Mac CotEditor TextWrangler TextMate Type“texteditor”inyour AppleStore(filtertofree)
  • 9. PyCharmcommunity edition Visual Codeof Microsoft Spyder, a scientific environment (included in Anaconda) Jupyter with IPython behind the scene. IDLE(comes with Python) KomodoofActiveState Aptana Pyscripter PyDev(for Eclipse) Wing IDE IDEs
  • 10. More or less theonly thing I do on thecommand line with pythonis to checkthe version number: Python on the command line 1 python -V 2 python --version
  • 11. Youcan runsome Pythoncode without creating a file, but I don’t rememeber ever needing this. If you insists Python on the command line 1python-c "print 42" 1 python3 -c"print(42)" Typethe following to get thedetails: 1man python cmdline
  • 12. Createa file called hello.py with the above content. Open yourterminal or the Anaconda Prompt on MS Windows inthe directory (folder) Changeto thedirectory whereyousaved the file. Runit by typing python hello.py or python3hello.py Theextension is .py-mostly for the editor (but also for modules). Parentheses after print() are required in Python3, but usethem evenif youare stuck onPython 2. First script - hello world
  • 13. 1print("hello") 2 3 # Comments for other developers 4 5print("world") # morecomments 6 7 # print("Thisis not printed") Comments
  • 14. 1 greeting = "Hello World!" 2 print(greeting)” Variables Exercise: Hello world) Tryyourenvironment: Makesure you haveaccess to the right version of Python. Install Pythonif needed.
  • 15. What is programming? Use some language totell the computer what todo. Like a cooking recepie it has step-by-stepinstructions. Taking acomplex problemand dividing it into small steps acomputer can do.
  • 16. What are the programming languages A computer CPUis createdfrom transistors, 1and 0 values. (aka. bits) Its language consists of numbers. (e.g 37 means move the content of ax register to bxregister) English? too complex, toomuch ambiguity. Programming languages are in-beteen.
  • 17. A programming language Built-in words: print, len, type,def,… Literal values: numbers, strings Operators:+ - * = , ; … Grammar (syntax) User-createdwords: variables, functions, classes, ….
  • 18. Words and punctuation matter! What did you chose? (Correctly:choose, but people will usually understand.) Lets do the homework. (Correctly:Let’s, but most people will understand.) Let’s eat, grandpa! Let’s eat grandpa!
  • 19. Words and punctuation matter! Whatdid you chose? (Correctly:choose, butpeoplewill usuallyunderstand.) Letsdo thehomework.(Correctly:Let’s,butmostpeoplewill understand.) Let’seat,grandpa! Let’seatgrandpa! Programminglanguageshavea lotlesswords,buttheyarevery stricton thegrammar(syntax). Amising comma can breakyour code. Amissing space willchange themeaningof your code. Anincorreectwordcan ruinyour day.
  • 20. Literals, Value Types in Python “ 1print(type(23) ) #int 2 print(type(3.14) ) #float 3 print(type("hello")) #str 4 5 print(type("23") ) #str 6 print(type("3.24") ) #str 7 8 print(type(None)) #NoneType 9 print(type(True)) #bool 10 print(type(False) ) #bool 11 12 print(type([])) # list 13 print(type({})) # dict 14 15 print(type(hello)) # NameError:name'hello' is notdefined 16 print("Stillrunning")
  • 21. Multiply string 1width= "23" 2height= "17" 3area= width*height 4print(area) 1Traceback(most recentcall last): 2 File"python/examples/basics/rectangular_strings.py",line3, in<module> 3 area=width*height 4 TypeError:can't multiplysequence by non-intof type 'str”
  • 22. Add numbers “1a =19 2b= 23 3c =a + b 4print(c) #42”
  • 23. Add numbers & Add strings “1a = 19 2 b = 23 3 c = a + b 4 print(c) # 42” 1 a = "19" 2 b = "23" 3 c = a + b 4 print(c) # 1923 Numbers Strings Exercise: Calculations “Extend the rectangular_basic.py from above to print both the area and the circumferenceof the rectangle. Write a script that has a variable holding the radius of a circleand prints out the area of the circleand the circumferenceof the circle. Write a script that has two numbers a and b and prints out the results of a+b, a-b, a*b, a/b”
  • 24. Solution: Calculations 1a =19 2b = 23 3c= a + b 4prin“1width = 23 2height= 17 3area = width *height 4print("The area is", area) # 391 5circumference = 2*(width + height) 6print("The circumference is", circumference) # 80 1r= 7 2pi= 3.14 3print("The area is", r* r* pi) # 153.86 4print("The circumference is", 2* r* pi) # 43.96
  • 25. Solution: Calculations 1importmath 2 3r= 7 4print("The area is", r* r* math.pi) # 153.9380400258998 5print("The circumference is", 2* r* math.pi) # 43.982297150257104 1a =3 2b = 2 3 4print(a+b) # 5 5print(a-b) # 1 “6print(a*b) # 6 7print(a/b) # 1.5”
  • 26. Solution: Calculations 1importmath 2 3r= 7 4print("The area is", r* r* math.pi) # 153.9380400258998 5print("The circumference is", 2* r* math.pi) # 43.982297150257104 1a =3 2b = 2 3 4print(a+b) # 5 5print(a-b) # 1 “6print(a*b) # 6 7print(a/b) # 1.5”