SlideShare a Scribd company logo
1 of 32
Welcome!
Python SIG – Students with
programming experience (PYA) –
Class 1 – 12-9-15
Ask doubts and give feedback
Let’s learn Python
hello world!
• The traditional first program
• In Python 2:
–print ‘hello world!’
• In Python 3:
–print(‘hello world!’)
2 vs 3
• 2.7 last in 2 series
• 3 under development
• Ultimately, not much difference
• “The most drastic improvement is
the better Unicode support (with all
text strings being Unicode by
default)” [1]
2 vs 3
• Difference in print – statement,
NOT function
• Libraries, libraries, libraries
Why 2 then?
• Tools & support – 2to3, future
module
• Libraries, libraries, libraries. Example:
Web development
• Easy to learn the other
What is code?
What is code?
• Any fool can write code that a computer can
understand. Good programmers write code
that humans can understand.
Martin Fowler, "Refactoring: Improving the
Design of Existing Code" [2]
Objects, objects everywhere!
• “Everything in Python is an object, and almost
everything has attributes and methods. All
functions have a built-in attribute __doc__,
which returns the doc string defined in the
function's source code.” [3]
From Dive Into Python by Mark Pilgrim
• help(int)
Python implementations
• Language and implementation – separate
issues
• Language == syntax
• “An "implementation" of Python should be
taken to mean a program or environment
which provides support for the execution of
programs written in the Python language” [4]
From wiki.python.org
Python implementations
• CPython – reference implementation
• Others:
PyPy – Python in Python - compiled
IronPython - .NET comaptible
Jython – JVM compatible
• Further reading:
http://www.toptal.com/python/why-are-
there-so-many-pythons
CPython
• Interpreted; with “bytecode” in between (like
Java)
• C heritage
• Examples:
– Can use numbers as boolean types; though a
separate boolean type exists
– __name__ == __main__
Obligatory xkcd reference [5]
Explaining the comic - why Python
is awesome
• Dynamic vs static typing
• Whitespace as indentation
• Strongly typed vs weakly typed languages
• REPLs – rapid prototyping
• Interpreted – line by line; easier to find errors
import - ing
• Libraries and packages
• Batteries included philosophy of Python
• import antigravity
• import this
• import lotsofotherawesomestuff
• import modulename (BTW, modules (== .py files))
• from modulename import methodname
(BTW, methods ((not exactly) == functions))
Python is just words
• and del from not while as elif global or with
assert else if pass yield break except import
print class exec in raise continue finally is
return def for lambda try
• + variables
• + structure that you create
User input
• Complex programs = input + efficient
computation + output
• raw_input, NOT input
• raw_input – reads as string, so convert when
required (strongly typed, remember?)
• Example:
– var = raw_input(prompt)
Assignment statements
• Assignment is =
• ( and equality is ==, but you know this right?)
• Variable names should be sensible
• varname = computation / input
• Depends on frame
(Important) Built-in types
• boolean
• int
• float
• string
• list
• tuple
• dictionary
General idea
• Flexibility in Python
• Lists >> Arrays
• Methods – making things simpler
Mutability
• What is it?
• Why is it important?
Immutable
• int
• float
• string
• tuple
Mutable
• list
• dictionary
Operations
• + - * / % and ** for exponentiation
• Also +=, -=, *=, /=
• Floating point arithmetic
– [int].0
– Or float()
Boolean
• True / False
• >
• <
• ==
• !=
• >=
• <=
• is , is not (same as id())
Strings
• Immutable
• Single or double, they don’t care
• Raw strings
• Escape sequences
• String slicing – string[start:stop:step]
• We count from 0 (why?)
• String methods
Read the documentation
• If you know programming, (which you say you
do) reading the documentation is the best way
to learn
• Don’t have to memorise, only know how to
find what you need
In-class assignment
• Start coding!
• Use help() and dir()
• Use the offline docs
Thanks!
Pranav S Bijapur,
ECE, BMSCE, Bangalore
b.pranavshankar@gmail.com
Telegram - @pranavsb
References
1 -
https://wiki.python.org/moin/Python2orPyth
on3
2 -
https://en.wikiquote.org/wiki/Martin_Fowler
3 -
http://www.diveintopython.net/getting_to_kn
ow_python/everything_is_an_object.html
References
4 -
https://wiki.python.org/moin/PythonImpleme
ntations
5 -
https://www.xkcd.com/353/

More Related Content

What's hot

Python Seminar PPT
Python Seminar PPTPython Seminar PPT
Python Seminar PPTShivam Gupta
 
Introduction to Python Programming
Introduction to Python ProgrammingIntroduction to Python Programming
Introduction to Python ProgrammingAkhil Kaushik
 
Mypy pycon-fi-2012
Mypy pycon-fi-2012Mypy pycon-fi-2012
Mypy pycon-fi-2012jukkaleh
 
An Introduction to Python Programming
An Introduction to Python ProgrammingAn Introduction to Python Programming
An Introduction to Python ProgrammingMorteza Zakeri
 
Python Programming ppt
Python Programming pptPython Programming ppt
Python Programming pptismailmrribi
 
GDG Helwan Introduction to python
GDG Helwan Introduction to pythonGDG Helwan Introduction to python
GDG Helwan Introduction to pythonMohamed Hegazy
 
Python-00 | Introduction and installing
Python-00 | Introduction and installingPython-00 | Introduction and installing
Python-00 | Introduction and installingMohd Sajjad
 
Python presentation by Monu Sharma
Python presentation by Monu SharmaPython presentation by Monu Sharma
Python presentation by Monu SharmaMayank Sharma
 
Introduction to Python Programing
Introduction to Python ProgramingIntroduction to Python Programing
Introduction to Python Programingsameer patil
 
Introduction to python 3
Introduction to python 3Introduction to python 3
Introduction to python 3Youhei Sakurai
 

What's hot (20)

Python Seminar PPT
Python Seminar PPTPython Seminar PPT
Python Seminar PPT
 
Programming
ProgrammingProgramming
Programming
 
Introduction to Python Programming
Introduction to Python ProgrammingIntroduction to Python Programming
Introduction to Python Programming
 
Python ppt
Python pptPython ppt
Python ppt
 
Intro to Python
Intro to PythonIntro to Python
Intro to Python
 
Mypy pycon-fi-2012
Mypy pycon-fi-2012Mypy pycon-fi-2012
Mypy pycon-fi-2012
 
Python - the basics
Python - the basicsPython - the basics
Python - the basics
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
Basics of python
Basics of pythonBasics of python
Basics of python
 
Python 101
Python 101Python 101
Python 101
 
An Introduction to Python Programming
An Introduction to Python ProgrammingAn Introduction to Python Programming
An Introduction to Python Programming
 
Python Programming ppt
Python Programming pptPython Programming ppt
Python Programming ppt
 
Python Tutorial for Beginner
Python Tutorial for BeginnerPython Tutorial for Beginner
Python Tutorial for Beginner
 
GDG Helwan Introduction to python
GDG Helwan Introduction to pythonGDG Helwan Introduction to python
GDG Helwan Introduction to python
 
Python-00 | Introduction and installing
Python-00 | Introduction and installingPython-00 | Introduction and installing
Python-00 | Introduction and installing
 
Python basics
Python basicsPython basics
Python basics
 
Beginning Python
Beginning PythonBeginning Python
Beginning Python
 
Python presentation by Monu Sharma
Python presentation by Monu SharmaPython presentation by Monu Sharma
Python presentation by Monu Sharma
 
Introduction to Python Programing
Introduction to Python ProgramingIntroduction to Python Programing
Introduction to Python Programing
 
Introduction to python 3
Introduction to python 3Introduction to python 3
Introduction to python 3
 

Viewers also liked

Empresas ExpoTIC Maule 2009
Empresas ExpoTIC Maule 2009Empresas ExpoTIC Maule 2009
Empresas ExpoTIC Maule 2009ExpoTIC Maule
 
Langer dan 4 jaar doen met je pc
Langer dan 4 jaar doen met je pcLanger dan 4 jaar doen met je pc
Langer dan 4 jaar doen met je pcgroenkantoor
 
หลักเกณฑ์การจัดทำผังรายการสำหรับการให้บริการกระจายเสียงหรือโทรทัศน์ (ฉบับที่ ...
หลักเกณฑ์การจัดทำผังรายการสำหรับการให้บริการกระจายเสียงหรือโทรทัศน์ (ฉบับที่ ...หลักเกณฑ์การจัดทำผังรายการสำหรับการให้บริการกระจายเสียงหรือโทรทัศน์ (ฉบับที่ ...
หลักเกณฑ์การจัดทำผังรายการสำหรับการให้บริการกระจายเสียงหรือโทรทัศน์ (ฉบับที่ ...Victor Ronin
 
India under british rule
India under british ruleIndia under british rule
India under british ruleAahana Gurung
 
People-powered Health || Maxine Mackintosh || Future Health
People-powered Health || Maxine Mackintosh || Future HealthPeople-powered Health || Maxine Mackintosh || Future Health
People-powered Health || Maxine Mackintosh || Future HealthScience: Disrupt
 
Grape Solar
Grape SolarGrape Solar
Grape Solarrjanoff
 
땅울림 파이썬 스터디 intro
땅울림 파이썬 스터디 intro땅울림 파이썬 스터디 intro
땅울림 파이썬 스터디 intro건희 김
 
Effective response to adverse weather conditions using SolarPulse
Effective response to adverse weather conditions using SolarPulseEffective response to adverse weather conditions using SolarPulse
Effective response to adverse weather conditions using SolarPulseMachinePulse
 
First Solar: Strategic Analysis
First Solar: Strategic AnalysisFirst Solar: Strategic Analysis
First Solar: Strategic AnalysisLauren Zahringer
 
Aturcara majlis
Aturcara majlisAturcara majlis
Aturcara majlisWaty Isa
 
科普大平台:12/10 課程講義
科普大平台:12/10 課程講義科普大平台:12/10 課程講義
科普大平台:12/10 課程講義Ga-yo Huang
 
China pakistan economic corriddor
China pakistan economic corriddorChina pakistan economic corriddor
China pakistan economic corriddorSiddhartha Singh
 

Viewers also liked (17)

A comprehensive software infrastructure of .Net
A comprehensive software infrastructure of .Net  A comprehensive software infrastructure of .Net
A comprehensive software infrastructure of .Net
 
Empresas ExpoTIC Maule 2009
Empresas ExpoTIC Maule 2009Empresas ExpoTIC Maule 2009
Empresas ExpoTIC Maule 2009
 
Python
PythonPython
Python
 
Feature
FeatureFeature
Feature
 
Langer dan 4 jaar doen met je pc
Langer dan 4 jaar doen met je pcLanger dan 4 jaar doen met je pc
Langer dan 4 jaar doen met je pc
 
หลักเกณฑ์การจัดทำผังรายการสำหรับการให้บริการกระจายเสียงหรือโทรทัศน์ (ฉบับที่ ...
หลักเกณฑ์การจัดทำผังรายการสำหรับการให้บริการกระจายเสียงหรือโทรทัศน์ (ฉบับที่ ...หลักเกณฑ์การจัดทำผังรายการสำหรับการให้บริการกระจายเสียงหรือโทรทัศน์ (ฉบับที่ ...
หลักเกณฑ์การจัดทำผังรายการสำหรับการให้บริการกระจายเสียงหรือโทรทัศน์ (ฉบับที่ ...
 
India under british rule
India under british ruleIndia under british rule
India under british rule
 
People-powered Health || Maxine Mackintosh || Future Health
People-powered Health || Maxine Mackintosh || Future HealthPeople-powered Health || Maxine Mackintosh || Future Health
People-powered Health || Maxine Mackintosh || Future Health
 
Grape Solar
Grape SolarGrape Solar
Grape Solar
 
A tour of Python
A tour of PythonA tour of Python
A tour of Python
 
땅울림 파이썬 스터디 intro
땅울림 파이썬 스터디 intro땅울림 파이썬 스터디 intro
땅울림 파이썬 스터디 intro
 
Effective response to adverse weather conditions using SolarPulse
Effective response to adverse weather conditions using SolarPulseEffective response to adverse weather conditions using SolarPulse
Effective response to adverse weather conditions using SolarPulse
 
Aturcara tadbir
Aturcara tadbirAturcara tadbir
Aturcara tadbir
 
First Solar: Strategic Analysis
First Solar: Strategic AnalysisFirst Solar: Strategic Analysis
First Solar: Strategic Analysis
 
Aturcara majlis
Aturcara majlisAturcara majlis
Aturcara majlis
 
科普大平台:12/10 課程講義
科普大平台:12/10 課程講義科普大平台:12/10 課程講義
科普大平台:12/10 課程講義
 
China pakistan economic corriddor
China pakistan economic corriddorChina pakistan economic corriddor
China pakistan economic corriddor
 

Similar to What is Python?

web programming UNIT VIII python by Bhavsingh Maloth
web programming UNIT VIII python by Bhavsingh Malothweb programming UNIT VIII python by Bhavsingh Maloth
web programming UNIT VIII python by Bhavsingh MalothBhavsingh Maloth
 
Tutorial on-python-programming
Tutorial on-python-programmingTutorial on-python-programming
Tutorial on-python-programmingChetan Giridhar
 
Python indroduction
Python indroductionPython indroduction
Python indroductionFEG
 
python presntation 2.pptx
python presntation 2.pptxpython presntation 2.pptx
python presntation 2.pptxArpittripathi45
 
Python Programming1.ppt
Python Programming1.pptPython Programming1.ppt
Python Programming1.pptRehnawilson1
 
Python (3).pdf
Python (3).pdfPython (3).pdf
Python (3).pdfsamiwaris2
 
Python and Pytorch tutorial and walkthrough
Python and Pytorch tutorial and walkthroughPython and Pytorch tutorial and walkthrough
Python and Pytorch tutorial and walkthroughgabriellekuruvilla
 
prakash ppt (2).pdf
prakash ppt (2).pdfprakash ppt (2).pdf
prakash ppt (2).pdfShivamKS4
 
4_Introduction to Python Programming.pptx
4_Introduction to Python Programming.pptx4_Introduction to Python Programming.pptx
4_Introduction to Python Programming.pptxGnanesh12
 
Python programming language introduction unit
Python programming language introduction unitPython programming language introduction unit
Python programming language introduction unitmichaelaaron25322
 
Fundamentals of Python Programming
Fundamentals of Python ProgrammingFundamentals of Python Programming
Fundamentals of Python ProgrammingKamal Acharya
 
Introduction to Python – Learn Python Programming.pptx
Introduction to Python – Learn Python Programming.pptxIntroduction to Python – Learn Python Programming.pptx
Introduction to Python – Learn Python Programming.pptxHassanShah396906
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to pythonMohammed Rafi
 

Similar to What is Python? (20)

web programming UNIT VIII python by Bhavsingh Maloth
web programming UNIT VIII python by Bhavsingh Malothweb programming UNIT VIII python by Bhavsingh Maloth
web programming UNIT VIII python by Bhavsingh Maloth
 
Tutorial on-python-programming
Tutorial on-python-programmingTutorial on-python-programming
Tutorial on-python-programming
 
Python Programming
Python ProgrammingPython Programming
Python Programming
 
Python intro
Python introPython intro
Python intro
 
Python indroduction
Python indroductionPython indroduction
Python indroduction
 
python presntation 2.pptx
python presntation 2.pptxpython presntation 2.pptx
python presntation 2.pptx
 
Python 01.pptx
Python 01.pptxPython 01.pptx
Python 01.pptx
 
Introduction_to_Python.pptx
Introduction_to_Python.pptxIntroduction_to_Python.pptx
Introduction_to_Python.pptx
 
Python programming
Python programmingPython programming
Python programming
 
Python Programming1.ppt
Python Programming1.pptPython Programming1.ppt
Python Programming1.ppt
 
Python Demo.pptx
Python Demo.pptxPython Demo.pptx
Python Demo.pptx
 
Python (3).pdf
Python (3).pdfPython (3).pdf
Python (3).pdf
 
Python Demo.pptx
Python Demo.pptxPython Demo.pptx
Python Demo.pptx
 
Python and Pytorch tutorial and walkthrough
Python and Pytorch tutorial and walkthroughPython and Pytorch tutorial and walkthrough
Python and Pytorch tutorial and walkthrough
 
prakash ppt (2).pdf
prakash ppt (2).pdfprakash ppt (2).pdf
prakash ppt (2).pdf
 
4_Introduction to Python Programming.pptx
4_Introduction to Python Programming.pptx4_Introduction to Python Programming.pptx
4_Introduction to Python Programming.pptx
 
Python programming language introduction unit
Python programming language introduction unitPython programming language introduction unit
Python programming language introduction unit
 
Fundamentals of Python Programming
Fundamentals of Python ProgrammingFundamentals of Python Programming
Fundamentals of Python Programming
 
Introduction to Python – Learn Python Programming.pptx
Introduction to Python – Learn Python Programming.pptxIntroduction to Python – Learn Python Programming.pptx
Introduction to Python – Learn Python Programming.pptx
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 

More from PranavSB

Short Tech Quiz
Short Tech QuizShort Tech Quiz
Short Tech QuizPranavSB
 
Short Tech Quiz
Short Tech QuizShort Tech Quiz
Short Tech QuizPranavSB
 
Files and file objects (in Python)
Files and file objects (in Python)Files and file objects (in Python)
Files and file objects (in Python)PranavSB
 
Tuples, Dicts and Exception Handling
Tuples, Dicts and Exception HandlingTuples, Dicts and Exception Handling
Tuples, Dicts and Exception HandlingPranavSB
 
Functions, List and String methods
Functions, List and String methodsFunctions, List and String methods
Functions, List and String methodsPranavSB
 
if, while and for in Python
if, while and for in Pythonif, while and for in Python
if, while and for in PythonPranavSB
 

More from PranavSB (6)

Short Tech Quiz
Short Tech QuizShort Tech Quiz
Short Tech Quiz
 
Short Tech Quiz
Short Tech QuizShort Tech Quiz
Short Tech Quiz
 
Files and file objects (in Python)
Files and file objects (in Python)Files and file objects (in Python)
Files and file objects (in Python)
 
Tuples, Dicts and Exception Handling
Tuples, Dicts and Exception HandlingTuples, Dicts and Exception Handling
Tuples, Dicts and Exception Handling
 
Functions, List and String methods
Functions, List and String methodsFunctions, List and String methods
Functions, List and String methods
 
if, while and for in Python
if, while and for in Pythonif, while and for in Python
if, while and for in Python
 

Recently uploaded

HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...aditisharan08
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsMehedi Hasan Shohan
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningVitsRangannavar
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyFrank van der Linden
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 

Recently uploaded (20)

HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software Solutions
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learning
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The Ugly
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 

What is Python?

  • 1. Welcome! Python SIG – Students with programming experience (PYA) – Class 1 – 12-9-15
  • 2. Ask doubts and give feedback
  • 4. hello world! • The traditional first program • In Python 2: –print ‘hello world!’ • In Python 3: –print(‘hello world!’)
  • 5. 2 vs 3 • 2.7 last in 2 series • 3 under development • Ultimately, not much difference • “The most drastic improvement is the better Unicode support (with all text strings being Unicode by default)” [1]
  • 6. 2 vs 3 • Difference in print – statement, NOT function • Libraries, libraries, libraries
  • 7. Why 2 then? • Tools & support – 2to3, future module • Libraries, libraries, libraries. Example: Web development • Easy to learn the other
  • 9. What is code? • Any fool can write code that a computer can understand. Good programmers write code that humans can understand. Martin Fowler, "Refactoring: Improving the Design of Existing Code" [2]
  • 10. Objects, objects everywhere! • “Everything in Python is an object, and almost everything has attributes and methods. All functions have a built-in attribute __doc__, which returns the doc string defined in the function's source code.” [3] From Dive Into Python by Mark Pilgrim • help(int)
  • 11. Python implementations • Language and implementation – separate issues • Language == syntax • “An "implementation" of Python should be taken to mean a program or environment which provides support for the execution of programs written in the Python language” [4] From wiki.python.org
  • 12. Python implementations • CPython – reference implementation • Others: PyPy – Python in Python - compiled IronPython - .NET comaptible Jython – JVM compatible • Further reading: http://www.toptal.com/python/why-are- there-so-many-pythons
  • 13. CPython • Interpreted; with “bytecode” in between (like Java) • C heritage • Examples: – Can use numbers as boolean types; though a separate boolean type exists – __name__ == __main__
  • 15. Explaining the comic - why Python is awesome • Dynamic vs static typing • Whitespace as indentation • Strongly typed vs weakly typed languages • REPLs – rapid prototyping • Interpreted – line by line; easier to find errors
  • 16. import - ing • Libraries and packages • Batteries included philosophy of Python • import antigravity • import this • import lotsofotherawesomestuff • import modulename (BTW, modules (== .py files)) • from modulename import methodname (BTW, methods ((not exactly) == functions))
  • 17. Python is just words • and del from not while as elif global or with assert else if pass yield break except import print class exec in raise continue finally is return def for lambda try • + variables • + structure that you create
  • 18. User input • Complex programs = input + efficient computation + output • raw_input, NOT input • raw_input – reads as string, so convert when required (strongly typed, remember?) • Example: – var = raw_input(prompt)
  • 19. Assignment statements • Assignment is = • ( and equality is ==, but you know this right?) • Variable names should be sensible • varname = computation / input • Depends on frame
  • 20. (Important) Built-in types • boolean • int • float • string • list • tuple • dictionary
  • 21. General idea • Flexibility in Python • Lists >> Arrays • Methods – making things simpler
  • 22. Mutability • What is it? • Why is it important?
  • 25. Operations • + - * / % and ** for exponentiation • Also +=, -=, *=, /= • Floating point arithmetic – [int].0 – Or float()
  • 26. Boolean • True / False • > • < • == • != • >= • <= • is , is not (same as id())
  • 27. Strings • Immutable • Single or double, they don’t care • Raw strings • Escape sequences • String slicing – string[start:stop:step] • We count from 0 (why?) • String methods
  • 28. Read the documentation • If you know programming, (which you say you do) reading the documentation is the best way to learn • Don’t have to memorise, only know how to find what you need
  • 29. In-class assignment • Start coding! • Use help() and dir() • Use the offline docs
  • 30. Thanks! Pranav S Bijapur, ECE, BMSCE, Bangalore b.pranavshankar@gmail.com Telegram - @pranavsb
  • 31. References 1 - https://wiki.python.org/moin/Python2orPyth on3 2 - https://en.wikiquote.org/wiki/Martin_Fowler 3 - http://www.diveintopython.net/getting_to_kn ow_python/everything_is_an_object.html