SlideShare a Scribd company logo
By
Karthik Prakash
• Introduction to Python

• Interactive “Shell”

• Basic Types and Containers

• Control Structures
“Remarkable power with very clear syntax”

Python is an Interpreted, Object Oriented
Programming language.

…it’s named after a television series Monty Python’s
Flying Circus

It was created by Guido Van Rossum in the year
1990…
Features :-
• Free and Open Source… Maintained by the PSF (Python Software
  Foundation)

• Rapid Prototyping

• Compiled to interpreted byte code .. sometimes called as Scripting
  language
     ….i.e Compilation is implicit

• Indentation for block structure
…“Life's better without braces(Bruce Eckel)”

• Extremely Portable (Windows,Linux,Unix,Mac… etc)

• Powerful Standard libraries
Two variations: IDLE (GUI) and PYTHON (command line)

• Most Python implementations work on CLI (Command Line Interface)

• Great for learning the language by experimenting with the library

• Great for testing your own modules

• Benefits of IDLE

•   Multi Windows Text Editor
•   Interactive Command Shell
•   Syntax Highlighting
•   Auto-Indentation
•   Auto Completion extended to Intellisence
•   None
•   Numbers and Floats
•   Complex Numbers …. (i + j)
•   Floating point
•   Boolean…. True or False
•   “Strings”
•   u“Unicode”
•   Tuples ()
•   Lists []
•   Dictonaries {}

• Built-in Function “type()”
• If, else, elif….

• Try and except

• While Loop

• For Loop
• List Comprehension

• Functions

• Doc Strings
    … Smart way of Documenting modules

• File Handling
    …… read , write , append to file
Single

 [ <item operation> for item in sequence <if condition>]

Nested

Special care has to be taken for the nested list
comprehension:

….when nesting list comprehensions, read from right to
left.
Function Definition :-

def name (arg1, arg2…. , argn)
  “““ Documentation ””” #optional
  statements
        .
        .
        .
  return expression

  name(arg1,arg2) # Call to <name>
File Modes

• Mode Meaning
• 'r' open for reading (default)

• 'w' open for writing, truncating the file first

• 'a' open for writing, appending to the end of the file if it
  exists

• 'b' binary mode
f = open(filename, [mode])

• read(), readline(), readlines()

• write(), writelines()

• seek(pos), tell()

• close()
• Classes
  o   Class Definition

  o   Class Objects

  o   Class Data members

  o   Class Methods

  o   Class Inheritance
class Stack:
"A well-known data structure…"
def __init__(self): # constructor
self.items = []
def push(self, x):
self.items.append(x) #. Push into the Stack…the sky is the limit
def pop(self):
x = self.items[-1] # Pop from the stack
del self.items[-1]
return x
def empty(self):
return len(self.items) == 0 # Boolean result
object = Stack() #--- Object of the Class “Stack”

….. Constructor invoked during Object instantiation


object.push(arg1) #---- Call to Class Method “push”


print object.items #---- Access the Class Data Member
• class BaseClass:

    baseDataVar = 10
    def baseMethods(self)
    statements

    class DerivedClass(BaseClass):

    def Method()
    print self.baseDataVar
    self.baseMethods() #-- Call to base class method

More Related Content

What's hot

Python programming
Python programmingPython programming
Python programming
Ganesh Bhosale
 
PhpStorm Cheat Sheet
PhpStorm Cheat SheetPhpStorm Cheat Sheet
PhpStorm Cheat Sheet
Kamrul Hasan
 
Who go Types in my Systems Programing!
Who go Types in my Systems Programing!Who go Types in my Systems Programing!
Who go Types in my Systems Programing!
Jared Roesch
 
Linux basics by Raj Miraje
Linux basics by Raj MirajeLinux basics by Raj Miraje
Linux basics by Raj Miraje
Raj Mirje
 
Python intro and competitive programming
Python intro and competitive programmingPython intro and competitive programming
Python intro and competitive programming
Suraj Shah
 
Prototype 패턴 (심만섭)
Prototype 패턴 (심만섭) Prototype 패턴 (심만섭)
Prototype 패턴 (심만섭)
YoungSu Son
 
Anonymous classes2
Anonymous classes2Anonymous classes2
Anonymous classes2
Mark Baker
 

What's hot (7)

Python programming
Python programmingPython programming
Python programming
 
PhpStorm Cheat Sheet
PhpStorm Cheat SheetPhpStorm Cheat Sheet
PhpStorm Cheat Sheet
 
Who go Types in my Systems Programing!
Who go Types in my Systems Programing!Who go Types in my Systems Programing!
Who go Types in my Systems Programing!
 
Linux basics by Raj Miraje
Linux basics by Raj MirajeLinux basics by Raj Miraje
Linux basics by Raj Miraje
 
Python intro and competitive programming
Python intro and competitive programmingPython intro and competitive programming
Python intro and competitive programming
 
Prototype 패턴 (심만섭)
Prototype 패턴 (심만섭) Prototype 패턴 (심만섭)
Prototype 패턴 (심만섭)
 
Anonymous classes2
Anonymous classes2Anonymous classes2
Anonymous classes2
 

Similar to Python Kick Start

Python ppt
Python pptPython ppt
Python ppt
Mohita Pandey
 
Python basic
Python basicPython basic
Python basic
SOHIL SUNDARAM
 
Python3
Python3Python3
Python3
Jiayun Zhou
 
Python first day
Python first dayPython first day
Python first day
MARISSTELLA2
 
Python first day
Python first dayPython first day
Python first day
farkhand
 
Python assignment help
Python assignment helpPython assignment help
Python assignment help
www.myassignmenthelp.net
 
File and directories in python
File and directories in pythonFile and directories in python
File and directories in python
Lifna C.S
 
Processing data with Python, using standard library modules you (probably) ne...
Processing data with Python, using standard library modules you (probably) ne...Processing data with Python, using standard library modules you (probably) ne...
Processing data with Python, using standard library modules you (probably) ne...
gjcross
 
Python - Lecture 9
Python - Lecture 9Python - Lecture 9
Python - Lecture 9
Ravi Kiran Khareedi
 
Python Programming for ArcGIS: Part I
Python Programming for ArcGIS: Part IPython Programming for ArcGIS: Part I
Python Programming for ArcGIS: Part I
DUSPviz
 
Programming in Python
Programming in Python Programming in Python
Programming in Python
Tiji Thomas
 
From Java to Python: beating the Stockholm syndrome
From Java to Python: beating the Stockholm syndromeFrom Java to Python: beating the Stockholm syndrome
From Java to Python: beating the Stockholm syndrome
Javier Arias Losada
 
05io
05io05io
Intro to Python
Intro to PythonIntro to Python
Intro to Python
Daniel Greenfeld
 
Java01
Java01Java01
Java01
Java01Java01

Similar to Python Kick Start (20)

Python ppt
Python pptPython ppt
Python ppt
 
Python basic
Python basicPython basic
Python basic
 
Ruby1_full
Ruby1_fullRuby1_full
Ruby1_full
 
Ruby1_full
Ruby1_fullRuby1_full
Ruby1_full
 
Python3
Python3Python3
Python3
 
Python first day
Python first dayPython first day
Python first day
 
Python first day
Python first dayPython first day
Python first day
 
Python assignment help
Python assignment helpPython assignment help
Python assignment help
 
Dynamic Python
Dynamic PythonDynamic Python
Dynamic Python
 
File and directories in python
File and directories in pythonFile and directories in python
File and directories in python
 
Processing data with Python, using standard library modules you (probably) ne...
Processing data with Python, using standard library modules you (probably) ne...Processing data with Python, using standard library modules you (probably) ne...
Processing data with Python, using standard library modules you (probably) ne...
 
Python - Lecture 9
Python - Lecture 9Python - Lecture 9
Python - Lecture 9
 
Python Programming for ArcGIS: Part I
Python Programming for ArcGIS: Part IPython Programming for ArcGIS: Part I
Python Programming for ArcGIS: Part I
 
Programming in Python
Programming in Python Programming in Python
Programming in Python
 
From Java to Python: beating the Stockholm syndrome
From Java to Python: beating the Stockholm syndromeFrom Java to Python: beating the Stockholm syndrome
From Java to Python: beating the Stockholm syndrome
 
05io
05io05io
05io
 
Intro to Python
Intro to PythonIntro to Python
Intro to Python
 
Java01
Java01Java01
Java01
 
Java01
Java01Java01
Java01
 
Java01
Java01Java01
Java01
 

Recently uploaded

BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
Nguyen Thanh Tu Collection
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
Academy of Science of South Africa
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Dr. Vinod Kumar Kanvaria
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdfMASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
goswamiyash170123
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
Digital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion DesignsDigital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion Designs
chanes7
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
Advantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO PerspectiveAdvantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO Perspective
Krisztián Száraz
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 

Recently uploaded (20)

BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdfMASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
Digital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion DesignsDigital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion Designs
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
Advantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO PerspectiveAdvantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO Perspective
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 

Python Kick Start

  • 2. • Introduction to Python • Interactive “Shell” • Basic Types and Containers • Control Structures
  • 3. “Remarkable power with very clear syntax” Python is an Interpreted, Object Oriented Programming language. …it’s named after a television series Monty Python’s Flying Circus It was created by Guido Van Rossum in the year 1990…
  • 4. Features :- • Free and Open Source… Maintained by the PSF (Python Software Foundation) • Rapid Prototyping • Compiled to interpreted byte code .. sometimes called as Scripting language ….i.e Compilation is implicit • Indentation for block structure …“Life's better without braces(Bruce Eckel)” • Extremely Portable (Windows,Linux,Unix,Mac… etc) • Powerful Standard libraries
  • 5. Two variations: IDLE (GUI) and PYTHON (command line) • Most Python implementations work on CLI (Command Line Interface) • Great for learning the language by experimenting with the library • Great for testing your own modules • Benefits of IDLE • Multi Windows Text Editor • Interactive Command Shell • Syntax Highlighting • Auto-Indentation • Auto Completion extended to Intellisence
  • 6. None • Numbers and Floats • Complex Numbers …. (i + j) • Floating point • Boolean…. True or False • “Strings” • u“Unicode” • Tuples () • Lists [] • Dictonaries {} • Built-in Function “type()”
  • 7. • If, else, elif…. • Try and except • While Loop • For Loop
  • 8. • List Comprehension • Functions • Doc Strings … Smart way of Documenting modules • File Handling …… read , write , append to file
  • 9. Single [ <item operation> for item in sequence <if condition>] Nested Special care has to be taken for the nested list comprehension: ….when nesting list comprehensions, read from right to left.
  • 10. Function Definition :- def name (arg1, arg2…. , argn) “““ Documentation ””” #optional statements . . . return expression name(arg1,arg2) # Call to <name>
  • 11. File Modes • Mode Meaning • 'r' open for reading (default) • 'w' open for writing, truncating the file first • 'a' open for writing, appending to the end of the file if it exists • 'b' binary mode
  • 12. f = open(filename, [mode]) • read(), readline(), readlines() • write(), writelines() • seek(pos), tell() • close()
  • 13. • Classes o Class Definition o Class Objects o Class Data members o Class Methods o Class Inheritance
  • 14. class Stack: "A well-known data structure…" def __init__(self): # constructor self.items = [] def push(self, x): self.items.append(x) #. Push into the Stack…the sky is the limit def pop(self): x = self.items[-1] # Pop from the stack del self.items[-1] return x def empty(self): return len(self.items) == 0 # Boolean result
  • 15. object = Stack() #--- Object of the Class “Stack” ….. Constructor invoked during Object instantiation object.push(arg1) #---- Call to Class Method “push” print object.items #---- Access the Class Data Member
  • 16. • class BaseClass: baseDataVar = 10 def baseMethods(self) statements class DerivedClass(BaseClass): def Method() print self.baseDataVar self.baseMethods() #-- Call to base class method