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.
Welcome to MEMpy    Brad Montgomery    http://mempy.org
print(hello world)
Python• multi-platform• multi-paradigm• dynamically-typed• big standard lib (tons of 3rd party libs)• open source• by Guid...
the interpreter• An interactive Python shell• In a *nix environment, open a terminal and  type: python• In Windows, run IDLE
IDLE
the interpreter>>> print(hello world)hello world>>> 31 + 1142>>>
functions# save this in a file named "greeting.py"def hello(input_name=world):    greeting = "Hello {name}".format(       ...
modules/packages• namespaces!• module: a file with python code:  greeting.py• package: a directory of python modules
modules/packages>>> from greetingapp import greeting>>>>>> greeting.hello()Hello world>>>>>> greeting.hello("Universe")Hel...
classesclass Greeter(object):    names = [World ]    def hello(self, names=None):        if names:            self.names =...
classes>>> from greeting import Greeter>>> g = Greeter()>>> g.hello()Hello World>>> g.hello([Bill, Betty])Hello BillHello ...
who’s using python?•   Google         •   EDU’s•   YouTube        •   CERN•   Nasa           •   ESRI•   Astra-Zeneca   • ...
learn more• http://learnpythonthehardway.org/• http://openbookproject.net/thinkCSpy/• http://docs.python.org/tutorial/
Upcoming SlideShare
Loading in …5
×

Hello world

874 views

Published on

Simple examples of python code implementing "hello world". Given at the first Memphis Python User group meeting (2011-11-21).

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Hello world

  1. 1. Welcome to MEMpy Brad Montgomery http://mempy.org
  2. 2. print(hello world)
  3. 3. Python• multi-platform• multi-paradigm• dynamically-typed• big standard lib (tons of 3rd party libs)• open source• by Guido van Rossum (BDFL)
  4. 4. the interpreter• An interactive Python shell• In a *nix environment, open a terminal and type: python• In Windows, run IDLE
  5. 5. IDLE
  6. 6. the interpreter>>> print(hello world)hello world>>> 31 + 1142>>>
  7. 7. functions# save this in a file named "greeting.py"def hello(input_name=world): greeting = "Hello {name}".format( name=input_name) return greeting>>> from greeting import hello>>>>>> hello()Hello world>>>>>> hello("Universe")Hello Universe
  8. 8. modules/packages• namespaces!• module: a file with python code: greeting.py• package: a directory of python modules
  9. 9. modules/packages>>> from greetingapp import greeting>>>>>> greeting.hello()Hello world>>>>>> greeting.hello("Universe")Hello Universe
  10. 10. classesclass Greeter(object): names = [World ] def hello(self, names=None): if names: self.names = names for name in self.names: s = Hello {n}.format(n=name) print(s)
  11. 11. classes>>> from greeting import Greeter>>> g = Greeter()>>> g.hello()Hello World>>> g.hello([Bill, Betty])Hello BillHello Betty>>>
  12. 12. who’s using python?• Google • EDU’s• YouTube • CERN• Nasa • ESRI• Astra-Zeneca • CCP Games• Lucasfilm • Silicon Valley Startups• Reddit • Hobbyists
  13. 13. learn more• http://learnpythonthehardway.org/• http://openbookproject.net/thinkCSpy/• http://docs.python.org/tutorial/

×