def 질문
def fun2():
return"나는 천재다."
a = fun2
print(a + "맞다")
라고 작성시 TypeError: unsupported operand type(s) for +: 'function' and 'str' 가 출력되는데요.
에러원인이
매개변수에 fun2() 입력시 "나는 천재다." 즉 str로 인식하지만 'fun2' 만 입력시 함수로 인식
따라서, 이상태에서 print(a + "맞다") 실행시 print(function + str)로 인식하여 TypeError 발생
라고 생각하는데요. 맞나요?
rlatpdbs1609 님 345
M 2021년 3월 14일 11:20 오후