class Pet: name = "" animal = "" age = 0 def __init__(self,name,animal,age): self.name = name self.animal = animal self.age = age def getName(self): return self.name def getAnimal(self): return self.animal def getAge(self): return self.age name = raw_input("What is the name of your pet?") animal = raw_input("What kind of animal is your pet?") age = raw_input("How old is your pet?") print("{} is a/an {}-year-old {}".format(self.name, self.age, self.species))
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