#------------------------------------------------------------ #Student: Austin Wells #Class: CIS122 #Date: 6/5/2015 #Program Title: Chapter 14 Programming Excercise 1.py #(pet class) #Program Description: This function solves Ackermann's Function # ------------------------------------------------------------ class Pet: def __init__(self): self.name = "" self.petType = "" self.age = 0 def setName(self, name): self.name = name def setPetType(self, petType): self.petType = petType def setAge(self, age): self.age = age def getName(self): return self.name def getPetType (self): return self.petType def getAge (self): return self.age def userInput (inputStr): input = raw_input (inputStr) print(input + "\n") return input def printPetItems (pet): print (pet.getName ()) print (pet.getPetType ()) print (pet.getAge ()) def main(): pet = Pet() pet.setName(userInput("Please enter a name for your pet: ")) pet.setPetType(userInput ("Please enter what type of pet you have: ") ) pet.setAge(userInput("Please enter the age of your pet: ")) printPetItems(pet) main ()
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