#Define a Pet Class class Pet: #Attributes\Properties of the Pet Class name="" type="" age=0 def setName(petName): petName.name = petName def setType(petType): petType.type = petType def setAge(petAge): petType.type = petAge def getName(): return petName.name def getType(): return petType.type def getAge(): return petType.type #Class is defined above, now we can use it myPet = Pet() x = raw_input() y = raw_input( z = raw_input() myPet.setName(x) myPet.setType(y) myPet.setAge(int(z) myPet.getName() myPet.getType() myPet.getAge()
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question