Answers for "what is methods in a class in py"

2

class in python

class LuckyLemur():
  	def __init__(self, description):
		self.description = description
	
    def reveal_description(self):
    	print(f'Lucky Lemur is {self.description}')

lucky_lemur = LuckyLemur('Pro')
lucky_lemur.reveal_description()
Posted by: Guest on June-02-2021
0

class in python

2+3j
(5, 0, 10)
Traceback (most recent call last):
  File "<string>", line 27, in <module>
    print(num1.attr)
AttributeError: 'ComplexNumber' object has no attribute 'attr'
Posted by: Guest on April-21-2021

Python Answers by Framework

Browse Popular Code Answers by Language