Skip to content

Instantly share code, notes, and snippets.

@thanoojgithub
Created December 15, 2015 09:46
Show Gist options
  • Save thanoojgithub/ca87763bd16d6df04e2f to your computer and use it in GitHub Desktop.
Save thanoojgithub/ca87763bd16d6df04e2f to your computer and use it in GitHub Desktop.
Python - HelloWorld program
class HW():
'Hello World'
'Modules Are Like Dictionaries'
helloM = {'hello': "Hello!"}
'init - constructs HW instance with assigned values'
def __init__(self, hello):
self.hello = hello
'method definition'
def say_hw(self):
print (HW.helloM['hello'], self.hello)
'instance creation'
helloMe = HW("thanooj")
'method call'
helloMe.say_hw()
@thanoojgithub
Copy link
Author

Hello World

@thanoojgithub
Copy link
Author

C:\Users\thanooj.kalathuru>python
Python 3.5.1rc1 (v3.5.1rc1:948ef16a6951, Nov 22 2015, 23:41:41) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()

C:\Users\thanooj.kalathuru>python HelloWorld.py
Hello! thanooj

C:\Users\thanooj.kalathuru>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment