Created
December 15, 2015 09:46
-
-
Save thanoojgithub/ca87763bd16d6df04e2f to your computer and use it in GitHub Desktop.
Python - HelloWorld program
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
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
Hello World