SlideShare una empresa de Scribd logo
1 de 27
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.

Más contenido relacionado

La actualidad más candente

Deep learning introduction
Deep learning introductionDeep learning introduction
Deep learning introductionAdwait 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 theeSAT 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 braineSAT Journals
 
Step Into World of Artificial Intelligence
Step Into World of Artificial IntelligenceStep Into World of Artificial Intelligence
Step Into World of Artificial IntelligenceExplore Skilled
 
Intelligence and artificial intelligence
Intelligence and artificial intelligenceIntelligence and artificial intelligence
Intelligence and artificial intelligenceDr. Uday Saikia
 
Deep learning short introduction
Deep learning short introductionDeep learning short introduction
Deep learning short introductionAdwait Bhave
 
Artificial intelligence Presentation.pptx
Artificial intelligence Presentation.pptxArtificial intelligence Presentation.pptx
Artificial intelligence Presentation.pptxAbdullah al Mamun
 
Artificial intelligence samrat tayade
Artificial intelligence samrat tayadeArtificial intelligence samrat tayade
Artificial intelligence samrat tayadeSamrat Tayade
 
Ai &amp; machine learning win sple
Ai &amp; machine learning   win spleAi &amp; machine learning   win sple
Ai &amp; machine learning win spleLewisWhite16
 
Artificial intelligence
Artificial intelligenceArtificial intelligence
Artificial intelligenceyham manansala
 
Iaetsd artificial intelligence
Iaetsd artificial intelligenceIaetsd artificial intelligence
Iaetsd artificial intelligenceIaetsd Iaetsd
 
Machine learning in startup
Machine learning in startupMachine learning in startup
Machine learning in startupMasas 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 learningOlivier 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
 

La actualidad más candente (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 a 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.pptxAkhdanMumtaz
 
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.pptxusvirat1805
 
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.pptxpcjoshi02
 
python presentation
python presentationpython presentation
python presentationVaibhavMawal
 
Python and Pytorch tutorial and walkthrough
Python and Pytorch tutorial and walkthroughPython and Pytorch tutorial and walkthrough
Python and Pytorch tutorial and walkthroughgabriellekuruvilla
 
Python introduction towards data science
Python introduction towards data sciencePython introduction towards data science
Python introduction towards data sciencedeepak 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.pptPigPug1
 
python-160403194316.pdf
python-160403194316.pdfpython-160403194316.pdf
python-160403194316.pdfgmadhu8
 
python lab programs.pdf
python lab programs.pdfpython lab programs.pdf
python lab programs.pdfCBJWorld
 
Python Seminar PPT
Python Seminar PPTPython Seminar PPT
Python Seminar PPTShivam Gupta
 

Similar a 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
PythonPython
Python
 
Python Seminar PPT
Python Seminar PPTPython Seminar PPT
Python Seminar PPT
 
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
 

Más de 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.pdfNaiyan Noor
 
Advanced Learning Algorithms.pdf
Advanced Learning Algorithms.pdfAdvanced Learning Algorithms.pdf
Advanced Learning Algorithms.pdfNaiyan Noor
 
HTML and CSS in depth.pdf
HTML and CSS in depth.pdfHTML and CSS in depth.pdf
HTML and CSS in depth.pdfNaiyan 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 noorNaiyan 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.pdfNaiyan 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.pdfNaiyan 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.pdfNaiyan Noor
 
Data Science Methodology...Naiyan Noor.pdf
Data Science Methodology...Naiyan Noor.pdfData Science Methodology...Naiyan Noor.pdf
Data Science Methodology...Naiyan Noor.pdfNaiyan 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.pdfNaiyan 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.pdfNaiyan 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.pdfNaiyan 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.pdfNaiyan 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.pdfNaiyan 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.pdfNaiyan 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.pdfNaiyan 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 .pdfNaiyan Noor
 
Linux Presentation
Linux PresentationLinux Presentation
Linux PresentationNaiyan Noor
 
UQx ieltsx certificate | edX
UQx ieltsx certificate | edXUQx ieltsx certificate | edX
UQx ieltsx certificate | edXNaiyan Noor
 
Using Python for Research-HarvardX
Using Python for Research-HarvardX Using Python for Research-HarvardX
Using Python for Research-HarvardX Naiyan Noor
 

Más de 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
 

Último

Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Christo Ananth
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesPrabhanshu Chaturvedi
 
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGMANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGSIVASHANKAR N
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdfKamal Acharya
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingrknatarajan
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdfankushspencer015
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduitsrknatarajan
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 

Último (20)

Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and Properties
 
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGMANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 

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”