👉 기본 환경

- Language: Python

- IDE: Replit

 

 

⌨️ 코드

1
2
print(("New lines can be created with a backslash and n.")
 
 
 

 

 

🖨️오류

SyntaxError: unexpected EOF while parsing

 

 

📡 원인

괄호의 짝이 맞지 않음: ( - 2개, ) - 1개

 

 

📰 해결 방법

1
2
print("New lines can be created with a backslash and n.")
 
 
 

괄호의 짝이 맞도록 수정: ( - 1개, ) - 1개

 

👉 기본 환경

- Language: Python

- IDE: Replit

 

 

⌨️ 코드

1
2
 print("Hello World!\nHello World!\nHello World!")
 
 
 

 

 

🖨️오류

IndentationError: unexpected indent

 

 

📡 원인

print 실행 시, 맨 앞의 공백이 존재

 

 

📰 해결 방법

1
2
print("Hello World!\nHello World!\nHello World!")
 
 
 

맨 앞 공백 제거

 

👉 기본 환경

- Language: Python

- IDE: Replit

 

 

⌨️ 코드

1
2
print("print("what to print")")
 
 
 

 

 

🖨️오류

SyntaxError: invalid syntax

 

 

📡 원인

문자열 선언 시, 문법적 오류 발생

"print("와 ")"만 문자열로 인식되면서, what to print 부분이 프로그램언어로 인식되어 발생

 

 

📰 해결 방법

1
2
3
print("print('what to print')")
print('print("what to print")')
 
 
 
"" 또는 ''을 출력하고 싶을 경우, 내부와 외부 문자열 선언 기호를 ""/''로 구분해서 사용
 

👉 기본 환경

- Language: Python

- IDE: Replit

 

 

⌨️ 코드

1
2
print("Hello World!)
 
 

 

 

🖨️오류

SyntaxError: EOL(End of Life) while scanning string literal

 

 

📡 원인

문자열 선언 시, 문법적 오류 발생

""가 맞지 않거나 문장부호(){}[]의 열림 닫힘이 맞지 않을 때 발생

 

 

📰 해결 방법

1
2
print("Hello World!")
 
 

""를 짝에 맞춰 수정