클래스 공부중인데 왜 오류가 뜨는지 모르겠습니다..
class FourCal:
def setdate(self,first,second):
self.first=first
self.second=second
def add(self):
result=self.first+self.second
return result
a=FourCal()
a.setdate(4.2)
print(a.add())
4랑2를 더한 6이 출력되야 하는데 오류가 뜹니다..
왜 그런건지 이유를 알고 싶습니다!
a.setdate(4.2) 에서 콤마(,)를 써야 하는데 마침표(.)를 쓰셨습니다.
콤마를 써야 각각의 인자로 구분합니다.
a.setdate(4,2) 처럼 4와 2 사이에 콤마를 쓰시면 정상적으로 실행됩니다.