1
저는 처음에는 파이썬 프로그래머입니다.하지만 필자가 직접 함수를 정의하고 사용하는 스크립트를 포함하여 여러 스크립트를 작성했습니다. IDLE 내에서 작동하는 사용자 정의 함수를 얻지 못하는 것 같습니다. 내가 미쳤거나 바보 같다면 궁금해. 누군가가 다음과 같은 결과를 설명해 주시겠습니까 감사합니다 :간단한 함수가 작동하지 않습니다. 오류가 표시되지 않습니다.
def f(x,y):
solution = x+y
return solution
f(2,2)
SyntaxError: invalid syntax
>>> a = f(2,2)
Traceback (most recent call last):
File "<pyshell#4>", line 1, in <module>
a = f(2,2)
NameError: name 'f' is not defined
def g(x):
solution = x + 2
return solution
g(2)
SyntaxError: invalid syntax
>>> a = g(2)
Traceback (most recent call last):
File "<pyshell#11>", line 1, in <module>
a = g(2)
NameError: name 'g' is not defined
남자, 편집 한 AND 답장에 저를 때려 눕힐 수 있습니다. – RocketDonkey