Answers for "how do u define class in python"

0

classes in python

class fruit:
  def __init__(self,color,taste,name):
    self.color = color
    self.name = name
    self.taste = taste
    
    def myfunc(self):
      print("{} = Taste:{}, Color:{}".format(self.name, self.taste, self.color))
      
f1 = fruit("Red", "Sweet", "Red Apple")
f1.myfunc()
Posted by: Guest on November-17-2021

Code answers related to "how do u define class in python"

Python Answers by Framework

Browse Popular Code Answers by Language