Answers for "how to crete a class with dogs in python"

0

how to crete a class with dogs in python

class Dogs():
  name = ""
  width = ""
  height = ""
  breed = ""
  trick = ""
  def __init__(self, name, width, height, breed, trick):
    self.name = name
    self.width = width
    self.height = height
    self.breed = breed
    self.trick = trick
  def getName(self):
    return self.name
  def getWidth(self):
    return self.width
  def getHeight(self):
    return self.height
  def getBreed(self):
    return self.breed
  def getTrick(self):
    return self.trick
Pet = Dogs(input("What is your dog's name: "), input("How wide is your dog: "), input("What is your dog's height: "), input("What is your dog's breed: "), input("What trick can your dog do: "))
print(Pet.getName(), "is", Pet.getWidth(), "wide and", Pet.getHeight(), "long. It can", Pet.getTrick() + "!", Pet.getName(), "is a cool", Pet.getBreed() + "!!!")
Posted by: Guest on July-09-2020

Python Answers by Framework

Browse Popular Code Answers by Language