Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
ABU ZAHED JONY
“Quotes” Perl is worse than Python because people wanted it worse - Larry Wall, Creator of Perl Python fits your brain -...
About Python very clear, readable syntax portable intuitive object orientation natural expression of procedural code ...
Hello Worldprint “Hello World” Hello Worlda=6print a; 6a=‘Hello’a=a+ 6 Errors               a=a + str(6)
*.py
Interpreter Output
Interpreter
Stringsa=‘Hello’a=“Hello”a=“I Can’t do this”a=“I ”Love” Python”a=‘I “Love” Python’HelloHelloI Can’t do thisI “Love” Python...
a=“Hello”print a[0]print len(a)print a[0:2]print a[2:]H5Hello
a=“Hello”print a[-1]print a[-2:] olo
More About str Classprint dir(str) [__add__, __class__, __contains__, __delattr__, __doc__, __eq__, __ge__,__getattribute_...
Help Classprint help(str.find)find(...)   S.find(sub [,start [,end]]) -> int  Return the lowest index in S where substring...
Some Basic Syntax(1)n Oddn is Odd and greater than 5n divided by 2 or 5
Some Basic Syntax(1)               //Array Declaration               a=[]215Using Range:215True
List(1)a=[3,1,5]b=[4,2]c=a+bprint cdel c[2]print cprint 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==bprint sorted(...
List and Sorta=[ax,aae,aac]                       return 1,”Hello World”def mFun(s):                       a,b=mFun(“Hi”) ...
Tuplesa=(1,2,1)print a[0]print len(a)b=[(1,2,3),(1,2,1),(1,4,1)]print a in b13True
Tuples and sorta=[(1,"b"),(2,"a"),(1,"e")]print aprint sorted(a)def myTSort(d):  return d[0]print sorted(a,key=myTSort)k=(...
Dictionary d={} d[‘a’]=‘alpha’ d[‘o’]=‘omega’ d[‘g’]=‘gamma’ print d[‘a’]  alpha
Dictionaryd={}(d[a],d[o],d[g])=("alpha","omega","gamma")print dprint len(d){a: alpha, g: gamma, o: omega}3Check a value is...
Dictionaryd={}(d[a],d[o],d[g])=("alpha","omega","gamma")print d[‘a’]print d[‘x’] //???print d.get(‘x’) // return Noneprint...
Dictionaryd={}(d[a],d[o],d[g])=("alpha","omega","gamma")print d.keys()print d.values()print d.items()[a, g, o][alpha, gamm...
Dictionaryprint dir(dict)[__class__, __cmp__, __contains__, __delattr__, __delitem__,__doc__, __eq__, __ge__, __getattribu...
Filedef readFile(fileName):   // File write  f=open(fileName,r)    f=open(fileName,‘w)                          f.write(da...
Regular expressionimport rematch=re.search(od,"God oder")print match.group()match=re.search(rod,"God oder")print match.gro...
Regular expressionimport reprint re.findall(rar+,a ar arr)print re.findall(rar*,a ar arr)[ar, arr][a, ar, arr]+ for 1 or m...
Utility: OSimport osprint dir(os)[F_OK, O_APPEND, O_BINARY, O_CREAT, O_EXCL,O_NOINHERIT, O_RANDOM, O_RDONLY, O_RDWR,O_SEQU...
Utility: OSimport osprint help(os.unlink)unlink(...)  unlink(path)  Remove a file (same as remove(path)).print help(os.rmd...
Utility: HTTP request, URLtry:    passexcept:    passfinally:    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         r...
Code Source      http://jpython.blogspot.com/
Resource http://www.learnpython.org/ http://learnpythonthehardway.org/book/ http://code.google.com/edu/languages/google...
THANK YOU
Upcoming SlideShare
Loading in …5
×

python beginner talk slide

878 views

Published on

python beginner talk slide

Published in: Technology
  • Login to see the comments

python beginner talk slide

  1. 1. ABU ZAHED JONY
  2. 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. 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. 4. Hello Worldprint “Hello World” Hello Worlda=6print a; 6a=‘Hello’a=a+ 6 Errors a=a + str(6)
  5. 5. *.py
  6. 6. Interpreter Output
  7. 7. Interpreter
  8. 8. Stringsa=‘Hello’a=“Hello”a=“I Can’t do this”a=“I ”Love” Python”a=‘I “Love” Python’HelloHelloI Can’t do thisI “Love” PythonI “Love” Python
  9. 9. a=“Hello”print a[0]print len(a)print a[0:2]print a[2:]H5Hello
  10. 10. a=“Hello”print a[-1]print a[-2:] olo
  11. 11. More About str Classprint 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. 12. Help Classprint 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. 13. Some Basic Syntax(1)n Oddn is Odd and greater than 5n divided by 2 or 5
  14. 14. Some Basic Syntax(1) //Array Declaration a=[]215Using Range:215True
  15. 15. List(1)a=[3,1,5]b=[4,2]c=a+bprint cdel c[2]print cprint len(c)[3,1,5,4,2][3,1,4,2]4
  16. 16. List(2)(a,b)=([3,1,5],[4,2])c=a+b c= sorted(c)print sorted(c)print a==bprint sorted(c,reverse=True)print cprint 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. 17. List and Sorta=[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]
  18. 18. Tuplesa=(1,2,1)print a[0]print len(a)b=[(1,2,3),(1,2,1),(1,4,1)]print a in b13True
  19. 19. Tuples and sorta=[(1,"b"),(2,"a"),(1,"e")]print aprint 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. 20. Dictionary d={} d[‘a’]=‘alpha’ d[‘o’]=‘omega’ d[‘g’]=‘gamma’ print d[‘a’] alpha
  21. 21. Dictionaryd={}(d[a],d[o],d[g])=("alpha","omega","gamma")print dprint len(d){a: alpha, g: gamma, o: omega}3Check a value is in dictionary ???‘a’ in d
  22. 22. Dictionaryd={}(d[a],d[o],d[g])=("alpha","omega","gamma")print d[‘a’]print d[‘x’] //???print d.get(‘x’) // return Noneprint d.get(‘a’) if(d.get(‘a’)){ print ‘Yes’ }
  23. 23. Dictionaryd={}(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 orderfor k in sorted( d.keys() ): print d[k]print sorted(d.keys())
  24. 24. Dictionaryprint 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. 25. Filedef 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. 26. Regular expressionimport rematch=re.search(od,"God oder")print match.group()match=re.search(rod,"God oder")print match.group()odod
  27. 27. Regular expressionimport reprint re.findall(rar+,a ar arr)print re.findall(rar*,a ar arr)[ar, arr][a, ar, arr]+ for 1 or more* for 0 or moreprint dir(re)
  28. 28. Utility: OSimport osprint 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. 29. Utility: OSimport osprint help(os.unlink)unlink(...) unlink(path) Remove a file (same as remove(path)).print help(os.rmdir)rmdir(...) rmdir(path) Remove a directory.
  30. 30. Utility: HTTP request, URLtry: passexcept: passfinally: print “ok”
  31. 31. Some OOP class MyClass(AnotherClass): import myClass.py
  32. 32. Some OOP (Thread)
  33. 33. Access Shared Resource
  34. 34. Database(Sqlite)
  35. 35. Database(MySql)
  36. 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. 37. Code Source http://jpython.blogspot.com/
  38. 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
  39. 39. THANK YOU

×