커뮤니티
포인트
쿠폰
내 강의실
국비 신청 내역
증명서
계정
로그아웃
학습 질문
개발 일지
나의 활동
답변 대기중
1-5강 마지막 네카라쿠배 코딩문제 풀어보는거 질문요
[무료] 1시간 만에 정복하는 코딩테스트 합격법 v0
1주차
북마크
안*현
댓글
0
추천
0
조회수
20
조회수
20
답변 대기중

* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.

* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.



스니팻 복사하고 코딩 그대로 따라서 파이썬에 쳐봤는데 에러뜹니다 ㅠ








작성한 코드 및 에러 메세지

# "8zerothree2" → 8032
# "seven73nine" → 7739
# "two53eightfour" → 25384

s1 = "8zerothree2"
s2 = "seven73nine"
s3 = "two53eightfour"

def solution(s):
num_dict = {
    "zero": "0",
    "one": "1",
    "two": "2",
    "three": "3",
    "four": "4",
    "five": "5",
    "six": "6",
    "seven": "7",
    "eight": "8",
    "nine": "9",
    }

for str in num_dict:
    s = s.replace(str,num_dict[str])
    answer = int(s)
    return answer

print(solution(s1))
print(solution(s2))
print(solution(s3))



아래는 에러 메시지임다


C:\Users\82108\AppData\Local\Programs\Python\Python312\python.exe C:\Users\82108\Desktop\algorithm_note\Algorithm\eng_quiz.py 

 File "C:\Users\82108\Desktop\algorithm_note\Algorithm\eng_quiz.py", line 10

  num_dict = {

  ^

IndentationError: expected an indented block after function definition on line 9


Process finished with exit code 1



취소
 공유
취소
댓글 0
댓글 알림
나의얼굴