SlideShare a Scribd company logo
ABU ZAHED JONY
“Quotes”

 Perl is worse than Python because people wanted it worse
 - Larry Wall, Creator of Perl
 Python fits your brain
 - Bruce Eckel, Author: Thinking in Java
 Python is an excellent language & makes sensible
  compromises.
 - Peter Norvig. AI

 Life is better without brackets
About Python
 very clear, readable syntax
 portable
 intuitive object orientation
 natural expression of procedural code
 full modularity, supporting hierarchical packages
 very high level dynamic data types
 extensive standard libraries and third party modules for
  virtually every task
 extensions and modules easily written in C, C++ (or Java for
  Jython, or .NET languages for IronPython)
Hello World
print “Hello World”
 Hello World
a=6
print a;

 6


a=‘Hello’
a=a+ 6


 Errors               a=a + str(6)
*.py
Interpreter Output
Interpreter
Strings
a=‘Hello’
a=“Hello”
a=“I Can’t do this”
a=“I ”Love” Python”
a=‘I “Love” Python’
Hello
Hello
I Can’t do this
I “Love” Python
I “Love” Python
a=“Hello”
print a[0]
print len(a)
print a[0:2]
print a[2:]

H
5
He
llo
a=“Hello”


print a[-1]
print a[-2:]

 o
lo
More About str Class
print dir(str)
 ['__add__', '__class__', '__contains__', '__delattr__', '__doc__', '__eq__', '__ge__',
'__getattribute__', '__getitem__', '__getnewargs__', '__getslice__', '__gt__',
'__hash__', '__init__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__',
'__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__',
'__setattr__', '__str__', 'capitalize', 'center', 'count', 'decode', 'encode', 'endswith',
'expandtabs', 'find', 'index', 'isalnum', 'isalpha', 'isdigit', 'islower', 'isspace', 'istitle',
'isupper', 'join', 'ljust', 'lower', 'lstrip', 'partition', 'replace', 'rfind', 'rindex', 'rjust',
'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title',
'translate', 'upper', 'zfill']
Help Class
print help(str.find)
find(...)
   S.find(sub [,start [,end]]) -> int

  Return the lowest index in S where substring sub is found,
  such that sub is contained within s[start,end]. Optional
  arguments start and end are interpreted as in slice notation.

  Return -1 on failure.
Some Basic Syntax(1)




n Odd
n is Odd and greater than 5
n divided by 2 or 5
Some Basic Syntax(1)
               //Array Declaration
               a=[]




2
1
5
Using Range:
2
1
5
True
List(1)
a=[3,1,5]
b=[4,2]
c=a+b
print c
del c[2]
print c
print len(c)
[3,1,5,4,2]
[3,1,4,2]
4
List(2)
(a,b)=([3,1,5],[4,2])
c=a+b
                                       c= sorted(c)
print sorted(c)
print a==b
print sorted(c,reverse=True)
print c
print help(sorted)
[1,2,3,4,5]
False
[5,4,3,2,1]
[3, 1, 5, 4, 2]
Help on built-in function sorted in module __builtin__:
sorted(...)
   sorted(iterable, cmp=None, key=None, reverse=False) --> new sorted list
List and Sort
a=['ax','aae','aac']
                       return 1,”Hello World”

def mFun(s):
                       a,b=mFun(“Hi”)
  return s[-1]

print sorted(a,key=mFun)
print sorted(a,key=mFun,reverse=True)
print sorted(a,key=len)
['aac', 'aae', 'ax']
['ax', 'aae', 'aac']
['ax', 'aae', 'aac']
Tuples
a=(1,2,1)
print a[0]
print len(a)
b=[(1,2,3),(1,2,1),(1,4,1)]
print a in b

1
3
True
Tuples and sort
a=[(1,"b"),(2,"a"),(1,"e")]
print a
print sorted(a)
def myTSort(d):
  return d[0]
print sorted(a,key=myTSort)
k=(1,”e”)
print k in a

[(1, 'b'), (2, 'a'), (1, 'e')]
[(1, 'b'), (1, 'e'), (2, 'a')]
[(2, 'a'), (1, 'b'), (1, 'e')]
True
Dictionary


 d={}

 d[‘a’]=‘alpha’
 d[‘o’]=‘omega’
 d[‘g’]=‘gamma’

 print d[‘a’]
  alpha
Dictionary
d={}
(d['a'],d['o'],d['g'])=("alpha","omega","gamma")
print d
print len(d)
{'a': 'alpha', 'g': 'gamma', 'o': 'omega'}
3


Check a value is in dictionary ???

‘a’ in d
Dictionary
d={}
(d['a'],d['o'],d['g'])=("alpha","omega","gamma")
print d[‘a’]
print d[‘x’] //???
print d.get(‘x’) // return None
print d.get(‘a’)

 if(d.get(‘a’)){
      print ‘Yes’
 }
Dictionary
d={}
(d['a'],d['o'],d['g'])=("alpha","omega","gamma")
print d.keys()
print d.values()
print d.items()
['a', 'g', 'o']
['alpha', 'gamma', 'omega']
[('a', 'alpha'), ('g', 'gamma'), ('o', 'omega')]
What needs for sorted dictionary data(key order) ???
All data returns random order

for k in sorted( d.keys() ):
  print d[k]

print sorted(d.keys())
Dictionary
print dir(dict)
['__class__', '__cmp__', '__contains__', '__delattr__', '__delitem__',
'__doc__', '__eq__', '__ge__', '__getattribute__', '__getitem__', '__gt__',
'__hash__', '__init__', '__iter__', '__le__', '__len__', '__lt__', '__ne__',
'__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__',
'__setitem__', '__str__', 'clear', 'copy', 'fromkeys', 'get', 'has_key', 'items',
'iteritems', 'iterkeys', 'itervalues', 'keys', 'pop', 'popitem', 'setdefault', 'update',
'values']

print help(dict)


print help(dict.items)
File
def readFile(fileName):   // File write
  f=open(fileName,'r')    f=open(fileName,‘w')
                          f.write(data)
  for line in f:
                          f.close()
     print line,
   f.close()

def readFile(fileName):
  f=open(fileName,'r')
  text=f.read()
  print text
  f.close()


 f.seek(5)
Regular expression
import re

match=re.search('od',"God oder")
print match.group()
match=re.search(r'od',"God oder")
print match.group()

od
od
Regular expression
import re

print re.findall(r'ar+','a ar arr')
print re.findall(r'ar*','a ar arr')

['ar', 'arr']
['a', 'ar', 'arr']


+ for 1 or more
* for 0 or more

print dir(re)
Utility: OS
import os
print dir(os)
['F_OK', 'O_APPEND', 'O_BINARY', 'O_CREAT', 'O_EXCL',
'O_NOINHERIT', 'O_RANDOM', 'O_RDONLY', 'O_RDWR',
'O_SEQUENTIAL', 'UserDict', 'W_OK', 'X_OK', '_Environ', '__all__',
'__builtins__', '__doc__', '__file__', '__name__', '_copy_reg',
'_pickle_statvfs_result', 'abort', 'access', 'altsep', 'chdir', 'chmod', 'close',
'curdir', 'defpath', 'isatty', 'linesep', 'listdir', 'lseek', 'lstat', 'makedirs', 'mkdir',
'name', 'open', 'pardir', 'path', 'pathsep', 'pipe', 'popen', 'popen2', 'popen3',
'popen4', 'putenv', 'read', 'remove', 'removedirs', 'rename', 'renames', 'rmdir',
'sep', 'spawnl', 'spawnle', 'spawnv', 'spawnve', 'startfile', 'stat',
'stat_float_times', 'stat_result', 'statvfs_result', 'strerror', 'sys', 'system',
'tempnam', 'times', 'tmpfile', 'tmpnam', 'umask', 'unlink', 'unsetenv',
'urandom', 'utime', 'waitpid', 'walk', 'write']
Utility: OS
import os
print help(os.unlink)
unlink(...)
  unlink(path)
  Remove a file (same as remove(path)).

print help(os.rmdir)


rmdir(...)
  rmdir(path)
  Remove a directory.
Utility: HTTP request, URL




try:
    pass
except:
    pass
finally:
    print “ok”
Some OOP




 class MyClass(AnotherClass):
 import myClass.py
Some OOP (Thread)
Access Shared Resource
Database(Sqlite)
Database(MySql)
Reserved Word
   and           finally      pass
   assert        for          print
   break         from         raise
   class         global       return
   continue      if           try
   def           import       while
   del           in
   elif          is
   else          lambda
   except        not
   exec          or
Code Source


      http://jpython.blogspot.com/
Resource

 http://www.learnpython.org/
 http://learnpythonthehardway.org/book/
 http://code.google.com/edu/languages/google-
 python-class/

 http://love-python.blogspot.com
 http://jpython.blogspot.com
THANK YOU

More Related Content

What's hot

Python fundamentals - basic | WeiYuan
Python fundamentals - basic | WeiYuanPython fundamentals - basic | WeiYuan
Python fundamentals - basic | WeiYuan
Wei-Yuan Chang
 
Python Performance 101
Python Performance 101Python Performance 101
Python Performance 101Ankur Gupta
 
Introduction to Python and TensorFlow
Introduction to Python and TensorFlowIntroduction to Python and TensorFlow
Introduction to Python and TensorFlow
Bayu Aldi Yansyah
 
Euro python2011 High Performance Python
Euro python2011 High Performance PythonEuro python2011 High Performance Python
Euro python2011 High Performance Python
Ian Ozsvald
 
Learn python - for beginners - part-2
Learn python - for beginners - part-2Learn python - for beginners - part-2
Learn python - for beginners - part-2
RajKumar Rampelli
 
Learn 90% of Python in 90 Minutes
Learn 90% of Python in 90 MinutesLearn 90% of Python in 90 Minutes
Learn 90% of Python in 90 Minutes
Matt Harrison
 
Learn python in 20 minutes
Learn python in 20 minutesLearn python in 20 minutes
Learn python in 20 minutes
Sidharth Nadhan
 
Functional Programming In Java
Functional Programming In JavaFunctional Programming In Java
Functional Programming In Java
Andrei Solntsev
 
Matlab and Python: Basic Operations
Matlab and Python: Basic OperationsMatlab and Python: Basic Operations
Matlab and Python: Basic Operations
Wai Nwe Tun
 
Functional Programming with Groovy
Functional Programming with GroovyFunctional Programming with Groovy
Functional Programming with Groovy
Arturo Herrero
 
Advanced Python, Part 2
Advanced Python, Part 2Advanced Python, Part 2
Advanced Python, Part 2
Zaar Hai
 
Functional programming in java
Functional programming in javaFunctional programming in java
Functional programming in java
John Ferguson Smart Limited
 
Introduction to the basics of Python programming (part 3)
Introduction to the basics of Python programming (part 3)Introduction to the basics of Python programming (part 3)
Introduction to the basics of Python programming (part 3)
Pedro Rodrigues
 
Functional Programming & Event Sourcing - a pair made in heaven
Functional Programming & Event Sourcing - a pair made in heavenFunctional Programming & Event Sourcing - a pair made in heaven
Functional Programming & Event Sourcing - a pair made in heaven
Pawel Szulc
 
Metaprogramming in Haskell
Metaprogramming in HaskellMetaprogramming in Haskell
Metaprogramming in Haskell
Hiromi Ishii
 
Haskell in the Real World
Haskell in the Real WorldHaskell in the Real World
Haskell in the Real World
osfameron
 
Hammurabi
HammurabiHammurabi
Hammurabi
Mario Fusco
 
awesome groovy
awesome groovyawesome groovy
awesome groovyPaul King
 
An Intro to Python in 30 minutes
An Intro to Python in 30 minutesAn Intro to Python in 30 minutes
An Intro to Python in 30 minutes
Sumit Raj
 
Logic programming a ruby perspective
Logic programming a ruby perspectiveLogic programming a ruby perspective
Logic programming a ruby perspective
Norman Richards
 

What's hot (20)

Python fundamentals - basic | WeiYuan
Python fundamentals - basic | WeiYuanPython fundamentals - basic | WeiYuan
Python fundamentals - basic | WeiYuan
 
Python Performance 101
Python Performance 101Python Performance 101
Python Performance 101
 
Introduction to Python and TensorFlow
Introduction to Python and TensorFlowIntroduction to Python and TensorFlow
Introduction to Python and TensorFlow
 
Euro python2011 High Performance Python
Euro python2011 High Performance PythonEuro python2011 High Performance Python
Euro python2011 High Performance Python
 
Learn python - for beginners - part-2
Learn python - for beginners - part-2Learn python - for beginners - part-2
Learn python - for beginners - part-2
 
Learn 90% of Python in 90 Minutes
Learn 90% of Python in 90 MinutesLearn 90% of Python in 90 Minutes
Learn 90% of Python in 90 Minutes
 
Learn python in 20 minutes
Learn python in 20 minutesLearn python in 20 minutes
Learn python in 20 minutes
 
Functional Programming In Java
Functional Programming In JavaFunctional Programming In Java
Functional Programming In Java
 
Matlab and Python: Basic Operations
Matlab and Python: Basic OperationsMatlab and Python: Basic Operations
Matlab and Python: Basic Operations
 
Functional Programming with Groovy
Functional Programming with GroovyFunctional Programming with Groovy
Functional Programming with Groovy
 
Advanced Python, Part 2
Advanced Python, Part 2Advanced Python, Part 2
Advanced Python, Part 2
 
Functional programming in java
Functional programming in javaFunctional programming in java
Functional programming in java
 
Introduction to the basics of Python programming (part 3)
Introduction to the basics of Python programming (part 3)Introduction to the basics of Python programming (part 3)
Introduction to the basics of Python programming (part 3)
 
Functional Programming & Event Sourcing - a pair made in heaven
Functional Programming & Event Sourcing - a pair made in heavenFunctional Programming & Event Sourcing - a pair made in heaven
Functional Programming & Event Sourcing - a pair made in heaven
 
Metaprogramming in Haskell
Metaprogramming in HaskellMetaprogramming in Haskell
Metaprogramming in Haskell
 
Haskell in the Real World
Haskell in the Real WorldHaskell in the Real World
Haskell in the Real World
 
Hammurabi
HammurabiHammurabi
Hammurabi
 
awesome groovy
awesome groovyawesome groovy
awesome groovy
 
An Intro to Python in 30 minutes
An Intro to Python in 30 minutesAn Intro to Python in 30 minutes
An Intro to Python in 30 minutes
 
Logic programming a ruby perspective
Logic programming a ruby perspectiveLogic programming a ruby perspective
Logic programming a ruby perspective
 

Similar to python beginner talk slide

Python Workshop - Learn Python the Hard Way
Python Workshop - Learn Python the Hard WayPython Workshop - Learn Python the Hard Way
Python Workshop - Learn Python the Hard Way
Utkarsh Sengar
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
Ahmed Salama
 
Ejercicios de estilo en la programación
Ejercicios de estilo en la programaciónEjercicios de estilo en la programación
Ejercicios de estilo en la programación
Software Guru
 
Is Haskell an acceptable Perl?
Is Haskell an acceptable Perl?Is Haskell an acceptable Perl?
Is Haskell an acceptable Perl?
osfameron
 
Python utan-stodhjul-motorsag
Python utan-stodhjul-motorsagPython utan-stodhjul-motorsag
Python utan-stodhjul-motorsagniklal
 
Object Orientation vs. Functional Programming in Python
Object Orientation vs. Functional Programming in PythonObject Orientation vs. Functional Programming in Python
Object Orientation vs. Functional Programming in Python
Python Ireland
 
Music as data
Music as dataMusic as data
Music as data
John Vlachoyiannis
 
Python basic
Python basicPython basic
Python basic
Saifuddin Kaijar
 
GE8151 Problem Solving and Python Programming
GE8151 Problem Solving and Python ProgrammingGE8151 Problem Solving and Python Programming
GE8151 Problem Solving and Python Programming
Muthu Vinayagam
 
Python classes in mumbai
Python classes in mumbaiPython classes in mumbai
Python classes in mumbai
Vibrant Technologies & Computers
 
Ry pyconjp2015 turtle
Ry pyconjp2015 turtleRy pyconjp2015 turtle
Ry pyconjp2015 turtle
Renyuan Lyu
 
Practical Functional Programming Presentation by Bogdan Hodorog
Practical Functional Programming Presentation by Bogdan HodorogPractical Functional Programming Presentation by Bogdan Hodorog
Practical Functional Programming Presentation by Bogdan Hodorog
3Pillar Global
 
A Few of My Favorite (Python) Things
A Few of My Favorite (Python) ThingsA Few of My Favorite (Python) Things
A Few of My Favorite (Python) Things
Michael Pirnat
 
Python Workshop. LUG Maniapl
Python Workshop. LUG ManiaplPython Workshop. LUG Maniapl
Python Workshop. LUG Maniapl
Ankur Shrivastava
 
cover every basics of python with this..
cover every basics of python with this..cover every basics of python with this..
cover every basics of python with this..
karkimanish411
 
A gentle introduction to functional programming through music and clojure
A gentle introduction to functional programming through music and clojureA gentle introduction to functional programming through music and clojure
A gentle introduction to functional programming through music and clojure
Paul Lam
 
Clojure Intro
Clojure IntroClojure Intro
Clojure Intro
thnetos
 
Pune Clojure Course Outline
Pune Clojure Course OutlinePune Clojure Course Outline
Pune Clojure Course Outline
Baishampayan Ghose
 
Introduction to R
Introduction to RIntroduction to R
Introduction to Ragnonchik
 

Similar to python beginner talk slide (20)

Python Workshop - Learn Python the Hard Way
Python Workshop - Learn Python the Hard WayPython Workshop - Learn Python the Hard Way
Python Workshop - Learn Python the Hard Way
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
Ejercicios de estilo en la programación
Ejercicios de estilo en la programaciónEjercicios de estilo en la programación
Ejercicios de estilo en la programación
 
Is Haskell an acceptable Perl?
Is Haskell an acceptable Perl?Is Haskell an acceptable Perl?
Is Haskell an acceptable Perl?
 
Python utan-stodhjul-motorsag
Python utan-stodhjul-motorsagPython utan-stodhjul-motorsag
Python utan-stodhjul-motorsag
 
Object Orientation vs. Functional Programming in Python
Object Orientation vs. Functional Programming in PythonObject Orientation vs. Functional Programming in Python
Object Orientation vs. Functional Programming in Python
 
Music as data
Music as dataMusic as data
Music as data
 
Python basic
Python basicPython basic
Python basic
 
GE8151 Problem Solving and Python Programming
GE8151 Problem Solving and Python ProgrammingGE8151 Problem Solving and Python Programming
GE8151 Problem Solving and Python Programming
 
Python classes in mumbai
Python classes in mumbaiPython classes in mumbai
Python classes in mumbai
 
Ry pyconjp2015 turtle
Ry pyconjp2015 turtleRy pyconjp2015 turtle
Ry pyconjp2015 turtle
 
Practical Functional Programming Presentation by Bogdan Hodorog
Practical Functional Programming Presentation by Bogdan HodorogPractical Functional Programming Presentation by Bogdan Hodorog
Practical Functional Programming Presentation by Bogdan Hodorog
 
A Few of My Favorite (Python) Things
A Few of My Favorite (Python) ThingsA Few of My Favorite (Python) Things
A Few of My Favorite (Python) Things
 
Python Workshop. LUG Maniapl
Python Workshop. LUG ManiaplPython Workshop. LUG Maniapl
Python Workshop. LUG Maniapl
 
Intro to Python
Intro to PythonIntro to Python
Intro to Python
 
cover every basics of python with this..
cover every basics of python with this..cover every basics of python with this..
cover every basics of python with this..
 
A gentle introduction to functional programming through music and clojure
A gentle introduction to functional programming through music and clojureA gentle introduction to functional programming through music and clojure
A gentle introduction to functional programming through music and clojure
 
Clojure Intro
Clojure IntroClojure Intro
Clojure Intro
 
Pune Clojure Course Outline
Pune Clojure Course OutlinePune Clojure Course Outline
Pune Clojure Course Outline
 
Introduction to R
Introduction to RIntroduction to R
Introduction to R
 

Recently uploaded

FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
Vlad Stirbu
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.
ViralQR
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
Peter Spielvogel
 

Recently uploaded (20)

FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
 

python beginner talk slide

  • 2. “Quotes”  Perl is worse than Python because people wanted it worse - Larry Wall, Creator of Perl  Python fits your brain - Bruce Eckel, Author: Thinking in Java  Python is an excellent language & makes sensible compromises. - Peter Norvig. AI Life is better without brackets
  • 3. About Python  very clear, readable syntax  portable  intuitive object orientation  natural expression of procedural code  full modularity, supporting hierarchical packages  very high level dynamic data types  extensive standard libraries and third party modules for virtually every task  extensions and modules easily written in C, C++ (or Java for Jython, or .NET languages for IronPython)
  • 4. Hello World print “Hello World” Hello World a=6 print a; 6 a=‘Hello’ a=a+ 6 Errors a=a + str(6)
  • 8. Strings a=‘Hello’ a=“Hello” a=“I Can’t do this” a=“I ”Love” Python” a=‘I “Love” Python’ Hello Hello I Can’t do this I “Love” Python I “Love” Python
  • 9. a=“Hello” print a[0] print len(a) print a[0:2] print a[2:] H 5 He llo
  • 11. More About str Class print dir(str) ['__add__', '__class__', '__contains__', '__delattr__', '__doc__', '__eq__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__getslice__', '__gt__', '__hash__', '__init__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__str__', 'capitalize', 'center', 'count', 'decode', 'encode', 'endswith', 'expandtabs', 'find', 'index', 'isalnum', 'isalpha', 'isdigit', 'islower', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'partition', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill']
  • 12. Help Class print help(str.find) find(...) S.find(sub [,start [,end]]) -> int Return the lowest index in S where substring sub is found, such that sub is contained within s[start,end]. Optional arguments start and end are interpreted as in slice notation. Return -1 on failure.
  • 13. Some Basic Syntax(1) n Odd n is Odd and greater than 5 n divided by 2 or 5
  • 14. Some Basic Syntax(1) //Array Declaration a=[] 2 1 5 Using Range: 2 1 5 True
  • 15. List(1) a=[3,1,5] b=[4,2] c=a+b print c del c[2] print c print len(c) [3,1,5,4,2] [3,1,4,2] 4
  • 16. List(2) (a,b)=([3,1,5],[4,2]) c=a+b c= sorted(c) print sorted(c) print a==b print sorted(c,reverse=True) print c print help(sorted) [1,2,3,4,5] False [5,4,3,2,1] [3, 1, 5, 4, 2] Help on built-in function sorted in module __builtin__: sorted(...) sorted(iterable, cmp=None, key=None, reverse=False) --> new sorted list
  • 17. List and Sort a=['ax','aae','aac'] return 1,”Hello World” def mFun(s): a,b=mFun(“Hi”) return s[-1] print sorted(a,key=mFun) print sorted(a,key=mFun,reverse=True) print sorted(a,key=len) ['aac', 'aae', 'ax'] ['ax', 'aae', 'aac'] ['ax', 'aae', 'aac']
  • 19. Tuples and sort a=[(1,"b"),(2,"a"),(1,"e")] print a print sorted(a) def myTSort(d): return d[0] print sorted(a,key=myTSort) k=(1,”e”) print k in a [(1, 'b'), (2, 'a'), (1, 'e')] [(1, 'b'), (1, 'e'), (2, 'a')] [(2, 'a'), (1, 'b'), (1, 'e')] True
  • 20. Dictionary d={} d[‘a’]=‘alpha’ d[‘o’]=‘omega’ d[‘g’]=‘gamma’ print d[‘a’] alpha
  • 21. Dictionary d={} (d['a'],d['o'],d['g'])=("alpha","omega","gamma") print d print len(d) {'a': 'alpha', 'g': 'gamma', 'o': 'omega'} 3 Check a value is in dictionary ??? ‘a’ in d
  • 22. Dictionary d={} (d['a'],d['o'],d['g'])=("alpha","omega","gamma") print d[‘a’] print d[‘x’] //??? print d.get(‘x’) // return None print d.get(‘a’) if(d.get(‘a’)){ print ‘Yes’ }
  • 23. Dictionary d={} (d['a'],d['o'],d['g'])=("alpha","omega","gamma") print d.keys() print d.values() print d.items() ['a', 'g', 'o'] ['alpha', 'gamma', 'omega'] [('a', 'alpha'), ('g', 'gamma'), ('o', 'omega')] What needs for sorted dictionary data(key order) ??? All data returns random order for k in sorted( d.keys() ): print d[k] print sorted(d.keys())
  • 24. Dictionary print dir(dict) ['__class__', '__cmp__', '__contains__', '__delattr__', '__delitem__', '__doc__', '__eq__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setitem__', '__str__', 'clear', 'copy', 'fromkeys', 'get', 'has_key', 'items', 'iteritems', 'iterkeys', 'itervalues', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values'] print help(dict) print help(dict.items)
  • 25. File def readFile(fileName): // File write f=open(fileName,'r') f=open(fileName,‘w') f.write(data) for line in f: f.close() print line, f.close() def readFile(fileName): f=open(fileName,'r') text=f.read() print text f.close() f.seek(5)
  • 26. Regular expression import re match=re.search('od',"God oder") print match.group() match=re.search(r'od',"God oder") print match.group() od od
  • 27. Regular expression import re print re.findall(r'ar+','a ar arr') print re.findall(r'ar*','a ar arr') ['ar', 'arr'] ['a', 'ar', 'arr'] + for 1 or more * for 0 or more print dir(re)
  • 28. Utility: OS import os print dir(os) ['F_OK', 'O_APPEND', 'O_BINARY', 'O_CREAT', 'O_EXCL', 'O_NOINHERIT', 'O_RANDOM', 'O_RDONLY', 'O_RDWR', 'O_SEQUENTIAL', 'UserDict', 'W_OK', 'X_OK', '_Environ', '__all__', '__builtins__', '__doc__', '__file__', '__name__', '_copy_reg', '_pickle_statvfs_result', 'abort', 'access', 'altsep', 'chdir', 'chmod', 'close', 'curdir', 'defpath', 'isatty', 'linesep', 'listdir', 'lseek', 'lstat', 'makedirs', 'mkdir', 'name', 'open', 'pardir', 'path', 'pathsep', 'pipe', 'popen', 'popen2', 'popen3', 'popen4', 'putenv', 'read', 'remove', 'removedirs', 'rename', 'renames', 'rmdir', 'sep', 'spawnl', 'spawnle', 'spawnv', 'spawnve', 'startfile', 'stat', 'stat_float_times', 'stat_result', 'statvfs_result', 'strerror', 'sys', 'system', 'tempnam', 'times', 'tmpfile', 'tmpnam', 'umask', 'unlink', 'unsetenv', 'urandom', 'utime', 'waitpid', 'walk', 'write']
  • 29. Utility: OS import os print help(os.unlink) unlink(...) unlink(path) Remove a file (same as remove(path)). print help(os.rmdir) rmdir(...) rmdir(path) Remove a directory.
  • 30. Utility: HTTP request, URL try: pass except: pass finally: print “ok”
  • 31. Some OOP class MyClass(AnotherClass): import myClass.py
  • 36. Reserved Word  and  finally  pass  assert  for  print  break  from  raise  class  global  return  continue  if  try  def  import  while  del  in  elif  is  else  lambda  except  not  exec  or
  • 37. Code Source http://jpython.blogspot.com/
  • 38. Resource  http://www.learnpython.org/  http://learnpythonthehardway.org/book/  http://code.google.com/edu/languages/google- python-class/  http://love-python.blogspot.com  http://jpython.blogspot.com