Answers for "pyhton constructor name"

9

python class constructor

class Human:
	def __init__(self, name):
      self.name = name

h1 = Human("Bob")
print(h1.name) # prints Bob, the name passed from constructor
Posted by: Guest on May-21-2020
0

pyhton constructor name

class book :
    def __init__(self):
        self.name="Khan" 
        
B=book() 
print(B.name)
Posted by: Guest on April-01-2021

Python Answers by Framework

Browse Popular Code Answers by Language