a, d, n = map(int, input().split(' '))
an = a + d(n-1)
print(an)
상기 코드의 경우 다음과 같은 에러문이 출력되었다.
Traceback (most recent call last):
File "~~~", line 3, in <module>
an = a + d(n-1)
TypeError: 'int' object is not callable
d(n-1)이 아니라 d * (n-1)이 맞는다.
이것을 수정해도 코드업에서는 틀렸다고 채점했는데, 코드업 Q&A에서 split() 괄호 안을 비우라고 해서 그렇게 했더니 정답이 되었다.
다음은 왜 그렇게 된 것인지에 대한 답변이다.
split은 input을 ()가로 안의 것을 작동 시켜 주는 것 입니다. 예를 들어 a,b=input().split(" ")
이면 input을 여러개 받고 그 수를 띄었느냐에 따른 겁니다.
(출처: https://codeup.kr/d_thread.php?tid=11750&cid= )
'에러 기록' 카테고리의 다른 글
(Java)cannot resolve symbol 'println' (0) | 2021.11.03 |
---|---|
(Python)IndexError: list index out of range (0) | 2021.10.23 |
The import javax.annotation.Resource cannot be resolved 에러 (0) | 2021.08.01 |
Wrong username or password 에러 (0) | 2021.07.27 |
How to kill port 8080; 8080 포트 연결 끊기! (0) | 2021.07.20 |