SlideShare una empresa de Scribd logo
1 de 25
PYTHON

SHIVAM K. VERMA
Python is Interpreted.
Python is Interactive.
Python is Object-Oriented.
Python is Beginner’s Language.
HISTORY
• Python was developed by Guido van Rossum in the late
80s to earlier 90s at the National Research Institute.
• Python is derived from many other languages, including
ABC, Modula-3, C, C++, Algol-68, SmallTalk and Unix shell.
• Python is copyrighted. Like Perl, Python source code is
now available under the GNU General Public License.
• Python is now maintained by a core development team at
the institute, although Guido van Rossum still directing its
progress.
FEATURES
• Broad Standard Library.

• Portable.
• Extendable.
• Databases.
• Interactive Mode.
• Scalable.
• Integration.
HOW TO GET PYTHON
The most up-to-date and current source code, binaries,
documentation, news, etc. is available at the official
website of Python:

Python Official Website : http://www.python.org/
To Download : http://www.python.org/download/
RUNNING PYTHON
• There are 3 ways to start python:
1.

Interactive Interpreter.

2.

Script from the command line.

3.

Integrated development Environment.
INTERACTIVE INTERPRETER

SCRIPT FROM COMMAND LINE
• Unix – IDLE is the very first Unix
IDE for Python.
• Windows – Pythonwin is the first
Windows Interface for Python
and is an IDE with a GUI.
• Macintosh – The Macintosh
version of Python along with the
IDLE IDE is available.
PROGRAM COMPONENTS
• Programs can read in data.
• Programs can write results.
• In between reading and writing, programs can
compute, that is, do arithmetic (or logic).
• test, that is, decide what to do next.
• loop, that is, do the same actions a number of times.
• delegate, that is, ask other parts of the program to perform some
task.
•

• Also, programs can ignore comments.
DOING SIMPLE ARITHIMETIC
• Here are the arithmetic operators:
• + performs addition
• - performs subtraction
• * performs multiplication
• / performs division
• When dividing two integers, the result is an integer: 14 / 5 is 2
• % performs modulus (remainder of division): 14 % 5 is 4
• ** performs exponentiation
• The result of doing arithmetic is often assigned to a variable:
sum = 10 + 22 + 13 + 44 + 72
• Variables can be used in arithmetic:
average = sum / 5
DECISION AND TESTS
• Your program can decide what to do by making a test
• The result of a test is a boolean value, True or False
• Here are tests on numbers:
•
•
•
•
•
•

< means “is less than”
<= means “is less than or equal to”
== means “is equal to”
!= means “is not equal to”
>= means “is greater than or equal to”
< means “is greater than”

• These same tests work on strings
•

All capital letters are “less than” all lowercase letters.
COMPOUND TESTS
• Boolean values can be combined with these operators:
•
•
•

and – gives True if both sides are True
or – gives True if at least one side is True
not – given True, this returns False, and vice versa

• Examples
•
•

score > 0 and score <= 100
name == “Abhi" and not score > 100
THE if STATEMENT
• The if statement evaluates a test, and if it is True, performs the
following indented statements; but if the test is False, it does
nothing
• Examples:
•
•

if grade == "A+":
print "Congratulations!"
if score < 0 or score > 100:
print "That’s not possible!"
score = input("Enter a correct value: ")
if WITH else
• The if statement can have an optional else part, to be performed
if the test result is False
• Example:
•

if grade == "A+":
print "Congratulations!"
else:
print "You could do so much better."
print "Your mother will be disappointed."
if WITH elif
• The if statement can have any number of elif tests
• Only one group of statements is executed—those controlled by the
first test that passes
• Example:
•

if grade == "A":
print "Congratulations!"
elif grade == "B":
print "That's pretty good."
elif grade == "C":
print "Well, it's passing, anyway."
else:
print "You really blew it this time!"
INDENTATION
• Indentation is required and must be consistent
• Standard indentation is 4 spaces or one tab
• IDLE does this pretty much automatically for you

• Example:
•

if 2 + 2 != 4:
print "Oh, no!"
print "Arithmethic doesn't work!"
print "Time to buy a new computer."
Lists AND ranges
• A list is a sequence of values enclosed in brackets
•

Example: courses = ['CIT 591', 'CIT 592', 'CIT 593']

• You can refer to an individual value by putting a bracketed number (starting from 0)
after the list
•

Example: courses[2] is 'CIT 593'

• The len function tells you how many things are in a list
•

Example: len(courses) is 3

• range is a function that creates a list of integers, from the first number up to but not
including the second number
•

Example: range(0, 5) creates the list [0, 1, 2, 3, 4]

• If you give range a third number, it is used as the step size
•

Example: range(2, 10, 3) creates the list [2, 5, 8]
THE for LOOP
• A for loop performs the same statements for each value in a list
•

Example:
for n in range(1, 4):
print "This is the number", n
prints
This is the number 1
This is the number 2
This is the number 3

• The for loop uses a variable (in this case, n) to hold the current
value in the list
SUMMARY
• Arithmetic: + - * / %

< <= == != >= >

• Logic (boolean): True False and or not
• Strings: "Double quoted" or 'Single quoted'
• Lists: [1, 2, 3, 4]

len(lst)

• Input: input(question)

range(0, 100, 5)

raw_input(question)

• Decide: if test: elif test: else:
• For loop: for variable in list:
• While loop: while test:
• Calling a function: sum(numbers)
• Defining a function: def sum(numbers): return result
Queries ?
T
H
A
N
K
Y
O
U

Más contenido relacionado

La actualidad más candente

Python Programming Language | Python Classes | Python Tutorial | Python Train...
Python Programming Language | Python Classes | Python Tutorial | Python Train...Python Programming Language | Python Classes | Python Tutorial | Python Train...
Python Programming Language | Python Classes | Python Tutorial | Python Train...Edureka!
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to pythonAgung Wahyudi
 
Chapter 1 - INTRODUCTION TO PYTHON -MAULIK BORSANIYA
Chapter 1 - INTRODUCTION TO PYTHON -MAULIK BORSANIYAChapter 1 - INTRODUCTION TO PYTHON -MAULIK BORSANIYA
Chapter 1 - INTRODUCTION TO PYTHON -MAULIK BORSANIYAMaulik Borsaniya
 
Python Programming ppt
Python Programming pptPython Programming ppt
Python Programming pptismailmrribi
 
Introduction to-python
Introduction to-pythonIntroduction to-python
Introduction to-pythonAakashdata
 
Introduction to Python
Introduction to PythonIntroduction to Python
Introduction to PythonNowell Strite
 
Overview of python 2019
Overview of python 2019Overview of python 2019
Overview of python 2019Samir Mohanty
 
Python programming | Fundamentals of Python programming
Python programming | Fundamentals of Python programming Python programming | Fundamentals of Python programming
Python programming | Fundamentals of Python programming KrishnaMildain
 
Basic Concepts in Python
Basic Concepts in PythonBasic Concepts in Python
Basic Concepts in PythonSumit Satam
 
programming with python ppt
programming with python pptprogramming with python ppt
programming with python pptPriyanka Pradhan
 
Python Course | Python Programming | Python Tutorial | Python Training | Edureka
Python Course | Python Programming | Python Tutorial | Python Training | EdurekaPython Course | Python Programming | Python Tutorial | Python Training | Edureka
Python Course | Python Programming | Python Tutorial | Python Training | EdurekaEdureka!
 

La actualidad más candente (20)

Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
Python tutorial
Python tutorialPython tutorial
Python tutorial
 
Beginning Python Programming
Beginning Python ProgrammingBeginning Python Programming
Beginning Python Programming
 
Python Programming Language | Python Classes | Python Tutorial | Python Train...
Python Programming Language | Python Classes | Python Tutorial | Python Train...Python Programming Language | Python Classes | Python Tutorial | Python Train...
Python Programming Language | Python Classes | Python Tutorial | Python Train...
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
Python Basics
Python BasicsPython Basics
Python Basics
 
Chapter 1 - INTRODUCTION TO PYTHON -MAULIK BORSANIYA
Chapter 1 - INTRODUCTION TO PYTHON -MAULIK BORSANIYAChapter 1 - INTRODUCTION TO PYTHON -MAULIK BORSANIYA
Chapter 1 - INTRODUCTION TO PYTHON -MAULIK BORSANIYA
 
Programming with Python
Programming with PythonProgramming with Python
Programming with Python
 
Python Programming ppt
Python Programming pptPython Programming ppt
Python Programming ppt
 
Introduction to-python
Introduction to-pythonIntroduction to-python
Introduction to-python
 
Introduction to Python
Introduction to PythonIntroduction to Python
Introduction to Python
 
Python basic
Python basicPython basic
Python basic
 
Overview of python 2019
Overview of python 2019Overview of python 2019
Overview of python 2019
 
Python programming
Python programmingPython programming
Python programming
 
Python programming | Fundamentals of Python programming
Python programming | Fundamentals of Python programming Python programming | Fundamentals of Python programming
Python programming | Fundamentals of Python programming
 
Basic Concepts in Python
Basic Concepts in PythonBasic Concepts in Python
Basic Concepts in Python
 
programming with python ppt
programming with python pptprogramming with python ppt
programming with python ppt
 
Python
PythonPython
Python
 
Data types in python
Data types in pythonData types in python
Data types in python
 
Python Course | Python Programming | Python Tutorial | Python Training | Edureka
Python Course | Python Programming | Python Tutorial | Python Training | EdurekaPython Course | Python Programming | Python Tutorial | Python Training | Edureka
Python Course | Python Programming | Python Tutorial | Python Training | Edureka
 

Destacado

Vicio del lenguaje x
Vicio del lenguaje xVicio del lenguaje x
Vicio del lenguaje xPitaGNR
 
111010condencedresume
111010condencedresume111010condencedresume
111010condencedresumeRobert Payeur
 
Portfolio powerpoint 2nd final
Portfolio powerpoint 2nd finalPortfolio powerpoint 2nd final
Portfolio powerpoint 2nd finalBryan Wright
 
Sesi 9, membandingkan pasar konvensional &amp; digital..
Sesi 9, membandingkan pasar konvensional &amp; digital..Sesi 9, membandingkan pasar konvensional &amp; digital..
Sesi 9, membandingkan pasar konvensional &amp; digital..3rutstore
 
Proposal of an Advanced Retrieval System for Noble Qur’an
Proposal of an Advanced Retrieval System for Noble Qur’anProposal of an Advanced Retrieval System for Noble Qur’an
Proposal of an Advanced Retrieval System for Noble Qur’anAssem CHELLI
 
Soil investigation jda_13_194
Soil investigation jda_13_194Soil investigation jda_13_194
Soil investigation jda_13_194Ahmed Abbas
 
Contoh surat kuasa pembelian
Contoh surat kuasa pembelianContoh surat kuasa pembelian
Contoh surat kuasa pembelianilmu ilmu
 
Contoh metode pelaksanaan rehab jalan
Contoh metode pelaksanaan rehab jalanContoh metode pelaksanaan rehab jalan
Contoh metode pelaksanaan rehab jalanpt baranugraha
 
Erase Your Fear Patterns: EGO Behavior, The Bottom Line, And The 7 Universal ...
Erase Your Fear Patterns: EGO Behavior, The Bottom Line, And The 7 Universal ...Erase Your Fear Patterns: EGO Behavior, The Bottom Line, And The 7 Universal ...
Erase Your Fear Patterns: EGO Behavior, The Bottom Line, And The 7 Universal ...Runa Bouius
 

Destacado (17)

6 a bryanwright
6 a bryanwright6 a bryanwright
6 a bryanwright
 
Vicio del lenguaje x
Vicio del lenguaje xVicio del lenguaje x
Vicio del lenguaje x
 
111010condencedresume
111010condencedresume111010condencedresume
111010condencedresume
 
Portfolio powerpoint 2nd final
Portfolio powerpoint 2nd finalPortfolio powerpoint 2nd final
Portfolio powerpoint 2nd final
 
Espirtu dones espirituales
Espirtu dones espiritualesEspirtu dones espirituales
Espirtu dones espirituales
 
Mantanku
MantankuMantanku
Mantanku
 
Sesi 9, membandingkan pasar konvensional &amp; digital..
Sesi 9, membandingkan pasar konvensional &amp; digital..Sesi 9, membandingkan pasar konvensional &amp; digital..
Sesi 9, membandingkan pasar konvensional &amp; digital..
 
Proposal of an Advanced Retrieval System for Noble Qur’an
Proposal of an Advanced Retrieval System for Noble Qur’anProposal of an Advanced Retrieval System for Noble Qur’an
Proposal of an Advanced Retrieval System for Noble Qur’an
 
Hewan dan lingkungan
Hewan dan lingkunganHewan dan lingkungan
Hewan dan lingkungan
 
Soil investigation jda_13_194
Soil investigation jda_13_194Soil investigation jda_13_194
Soil investigation jda_13_194
 
(2)analisa tegangan
(2)analisa tegangan(2)analisa tegangan
(2)analisa tegangan
 
Contoh surat kuasa pembelian
Contoh surat kuasa pembelianContoh surat kuasa pembelian
Contoh surat kuasa pembelian
 
Contoh metode pelaksanaan rehab jalan
Contoh metode pelaksanaan rehab jalanContoh metode pelaksanaan rehab jalan
Contoh metode pelaksanaan rehab jalan
 
ICT LESSON PLAN
ICT LESSON PLANICT LESSON PLAN
ICT LESSON PLAN
 
Marketing 3.0 (part retold) in 60 slides
Marketing 3.0 (part retold) in 60 slidesMarketing 3.0 (part retold) in 60 slides
Marketing 3.0 (part retold) in 60 slides
 
Metode pelaksanaan kiru kiru
Metode pelaksanaan kiru kiruMetode pelaksanaan kiru kiru
Metode pelaksanaan kiru kiru
 
Erase Your Fear Patterns: EGO Behavior, The Bottom Line, And The 7 Universal ...
Erase Your Fear Patterns: EGO Behavior, The Bottom Line, And The 7 Universal ...Erase Your Fear Patterns: EGO Behavior, The Bottom Line, And The 7 Universal ...
Erase Your Fear Patterns: EGO Behavior, The Bottom Line, And The 7 Universal ...
 

Similar a Python

IoT-Week1-Day1-Lab.pptx
IoT-Week1-Day1-Lab.pptxIoT-Week1-Day1-Lab.pptx
IoT-Week1-Day1-Lab.pptxafsheenfaiq2
 
Python if_else_loop_Control_Flow_Statement
Python if_else_loop_Control_Flow_StatementPython if_else_loop_Control_Flow_Statement
Python if_else_loop_Control_Flow_StatementAbhishekGupta692777
 
Test Coverage: An Art and a Science
Test Coverage: An Art and a ScienceTest Coverage: An Art and a Science
Test Coverage: An Art and a ScienceTeamQualityPro
 
Python-Certification-Training-Day-1-2.pptx
Python-Certification-Training-Day-1-2.pptxPython-Certification-Training-Day-1-2.pptx
Python-Certification-Training-Day-1-2.pptxmuzammildev46gmailco
 
Algorithm week2(technovation)
Algorithm week2(technovation)Algorithm week2(technovation)
Algorithm week2(technovation)than sare
 
Exception handling and function in python
Exception handling and function in pythonException handling and function in python
Exception handling and function in pythonTMARAGATHAM
 
Lec-ProblemSolving.pptx
Lec-ProblemSolving.pptxLec-ProblemSolving.pptx
Lec-ProblemSolving.pptxmiansaad18
 
Basic concept of Python.pptx includes design tool, identifier, variables.
Basic concept of Python.pptx includes design tool, identifier, variables.Basic concept of Python.pptx includes design tool, identifier, variables.
Basic concept of Python.pptx includes design tool, identifier, variables.supriyasarkar38
 
Going loopy - Introduction to Loops.pptx
Going loopy - Introduction to Loops.pptxGoing loopy - Introduction to Loops.pptx
Going loopy - Introduction to Loops.pptxAmy Nightingale
 
Mastering Python lesson3b_for_loops
Mastering Python lesson3b_for_loopsMastering Python lesson3b_for_loops
Mastering Python lesson3b_for_loopsRuth Marvin
 
Python - Introduction
Python - IntroductionPython - Introduction
Python - Introductionstn_tkiller
 

Similar a Python (20)

python ppt.pptx
python ppt.pptxpython ppt.pptx
python ppt.pptx
 
IoT-Week1-Day1-Lab.pptx
IoT-Week1-Day1-Lab.pptxIoT-Week1-Day1-Lab.pptx
IoT-Week1-Day1-Lab.pptx
 
Python if_else_loop_Control_Flow_Statement
Python if_else_loop_Control_Flow_StatementPython if_else_loop_Control_Flow_Statement
Python if_else_loop_Control_Flow_Statement
 
Test Coverage: An Art and a Science
Test Coverage: An Art and a ScienceTest Coverage: An Art and a Science
Test Coverage: An Art and a Science
 
Python-Certification-Training-Day-1-2.pptx
Python-Certification-Training-Day-1-2.pptxPython-Certification-Training-Day-1-2.pptx
Python-Certification-Training-Day-1-2.pptx
 
Python basics
Python basicsPython basics
Python basics
 
module 2.pptx
module 2.pptxmodule 2.pptx
module 2.pptx
 
Python Basics
Python BasicsPython Basics
Python Basics
 
Introduction to C ++.pptx
Introduction to C ++.pptxIntroduction to C ++.pptx
Introduction to C ++.pptx
 
Java Tutorial
Java Tutorial Java Tutorial
Java Tutorial
 
Algorithm week2(technovation)
Algorithm week2(technovation)Algorithm week2(technovation)
Algorithm week2(technovation)
 
com.pptx
com.pptxcom.pptx
com.pptx
 
Exception handling and function in python
Exception handling and function in pythonException handling and function in python
Exception handling and function in python
 
Lec-ProblemSolving.pptx
Lec-ProblemSolving.pptxLec-ProblemSolving.pptx
Lec-ProblemSolving.pptx
 
Basic concept of Python.pptx includes design tool, identifier, variables.
Basic concept of Python.pptx includes design tool, identifier, variables.Basic concept of Python.pptx includes design tool, identifier, variables.
Basic concept of Python.pptx includes design tool, identifier, variables.
 
Going loopy - Introduction to Loops.pptx
Going loopy - Introduction to Loops.pptxGoing loopy - Introduction to Loops.pptx
Going loopy - Introduction to Loops.pptx
 
Mastering Python lesson3b_for_loops
Mastering Python lesson3b_for_loopsMastering Python lesson3b_for_loops
Mastering Python lesson3b_for_loops
 
Python - Introduction
Python - IntroductionPython - Introduction
Python - Introduction
 
Vba Class Level 1
Vba Class Level 1Vba Class Level 1
Vba Class Level 1
 
Qbasic notes
Qbasic notesQbasic notes
Qbasic notes
 

Último

9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...Pooja Nehwal
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...anjaliyadav012327
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxShobhayan Kirtania
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 

Último (20)

9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptx
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 

Python

  • 2. Python is Interpreted. Python is Interactive. Python is Object-Oriented. Python is Beginner’s Language.
  • 3. HISTORY • Python was developed by Guido van Rossum in the late 80s to earlier 90s at the National Research Institute. • Python is derived from many other languages, including ABC, Modula-3, C, C++, Algol-68, SmallTalk and Unix shell. • Python is copyrighted. Like Perl, Python source code is now available under the GNU General Public License. • Python is now maintained by a core development team at the institute, although Guido van Rossum still directing its progress.
  • 4.
  • 5. FEATURES • Broad Standard Library. • Portable. • Extendable. • Databases. • Interactive Mode. • Scalable. • Integration.
  • 6.
  • 7. HOW TO GET PYTHON The most up-to-date and current source code, binaries, documentation, news, etc. is available at the official website of Python: Python Official Website : http://www.python.org/ To Download : http://www.python.org/download/
  • 8. RUNNING PYTHON • There are 3 ways to start python: 1. Interactive Interpreter. 2. Script from the command line. 3. Integrated development Environment.
  • 10. • Unix – IDLE is the very first Unix IDE for Python. • Windows – Pythonwin is the first Windows Interface for Python and is an IDE with a GUI. • Macintosh – The Macintosh version of Python along with the IDLE IDE is available.
  • 11. PROGRAM COMPONENTS • Programs can read in data. • Programs can write results. • In between reading and writing, programs can compute, that is, do arithmetic (or logic). • test, that is, decide what to do next. • loop, that is, do the same actions a number of times. • delegate, that is, ask other parts of the program to perform some task. • • Also, programs can ignore comments.
  • 12. DOING SIMPLE ARITHIMETIC • Here are the arithmetic operators: • + performs addition • - performs subtraction • * performs multiplication • / performs division • When dividing two integers, the result is an integer: 14 / 5 is 2 • % performs modulus (remainder of division): 14 % 5 is 4 • ** performs exponentiation • The result of doing arithmetic is often assigned to a variable: sum = 10 + 22 + 13 + 44 + 72 • Variables can be used in arithmetic: average = sum / 5
  • 13. DECISION AND TESTS • Your program can decide what to do by making a test • The result of a test is a boolean value, True or False • Here are tests on numbers: • • • • • • < means “is less than” <= means “is less than or equal to” == means “is equal to” != means “is not equal to” >= means “is greater than or equal to” < means “is greater than” • These same tests work on strings • All capital letters are “less than” all lowercase letters.
  • 14. COMPOUND TESTS • Boolean values can be combined with these operators: • • • and – gives True if both sides are True or – gives True if at least one side is True not – given True, this returns False, and vice versa • Examples • • score > 0 and score <= 100 name == “Abhi" and not score > 100
  • 15. THE if STATEMENT • The if statement evaluates a test, and if it is True, performs the following indented statements; but if the test is False, it does nothing • Examples: • • if grade == "A+": print "Congratulations!" if score < 0 or score > 100: print "That’s not possible!" score = input("Enter a correct value: ")
  • 16. if WITH else • The if statement can have an optional else part, to be performed if the test result is False • Example: • if grade == "A+": print "Congratulations!" else: print "You could do so much better." print "Your mother will be disappointed."
  • 17. if WITH elif • The if statement can have any number of elif tests • Only one group of statements is executed—those controlled by the first test that passes • Example: • if grade == "A": print "Congratulations!" elif grade == "B": print "That's pretty good." elif grade == "C": print "Well, it's passing, anyway." else: print "You really blew it this time!"
  • 18. INDENTATION • Indentation is required and must be consistent • Standard indentation is 4 spaces or one tab • IDLE does this pretty much automatically for you • Example: • if 2 + 2 != 4: print "Oh, no!" print "Arithmethic doesn't work!" print "Time to buy a new computer."
  • 19. Lists AND ranges • A list is a sequence of values enclosed in brackets • Example: courses = ['CIT 591', 'CIT 592', 'CIT 593'] • You can refer to an individual value by putting a bracketed number (starting from 0) after the list • Example: courses[2] is 'CIT 593' • The len function tells you how many things are in a list • Example: len(courses) is 3 • range is a function that creates a list of integers, from the first number up to but not including the second number • Example: range(0, 5) creates the list [0, 1, 2, 3, 4] • If you give range a third number, it is used as the step size • Example: range(2, 10, 3) creates the list [2, 5, 8]
  • 20. THE for LOOP • A for loop performs the same statements for each value in a list • Example: for n in range(1, 4): print "This is the number", n prints This is the number 1 This is the number 2 This is the number 3 • The for loop uses a variable (in this case, n) to hold the current value in the list
  • 21. SUMMARY • Arithmetic: + - * / % < <= == != >= > • Logic (boolean): True False and or not • Strings: "Double quoted" or 'Single quoted' • Lists: [1, 2, 3, 4] len(lst) • Input: input(question) range(0, 100, 5) raw_input(question) • Decide: if test: elif test: else: • For loop: for variable in list: • While loop: while test: • Calling a function: sum(numbers) • Defining a function: def sum(numbers): return result
  • 22.
  • 23.