Python snippets

From ZENotes
(Difference between revisions)
Jump to: navigation, search
Line 17: Line 17:
 
     print("Hello, World")
 
     print("Hello, World")
 
      
 
      
 +
 +
'''"Oh no", she exclaimed, "Ben's bike is broken!"'''
 +
 +
    print('''"Oh no", she exclaimed, "Ben's bike is broken!"''')
 +
  
  
  
 
Back to [[Python]]
 
Back to [[Python]]

Revision as of 10:17, 1 May 2013

Hello World

   #---------------------------------------------------
   # This demo program shows off how elegant Python is!    
   # Written by Joe Soap, December 2010.
   # Anyone may freely copy or modify this program.
   #---------------------------------------------------
   
   print("Hello, World!")     # Isn't this easy!
   


If you are not sure what class a value falls into, Python has a function called type which can tell you.

   print(type("Hello, World!"))
   print(type(17))
   print("Hello, World")
   

"Oh no", she exclaimed, "Ben's bike is broken!"

   print("Oh no", she exclaimed, "Ben's bike is broken!")



Back to Python

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox