처음 배우는 프로그래밍(w.파이썬)

python invalid syntax

Python 3.9.2 (v3.9.2:1a79785e3e, Feb 19 2021, 09:09:00) 
[Clang 12.0.0 (clang-1200.0.32.29)] on darwin
Type "help", "copyright", "credits" or "license()" for more information.
>>> def print_message():
print("CS101 is fantastic!")
print("Programming is so much fun!")


>>> \print_message()
CS101 is fantastic!
Programming is so much fun!
>>> def repeat_message():
print message()

SyntaxError: invalid syntax
>>> def repeat_message():
print message()

SyntaxError: invalid syntax
>>> 


해결: 

 

이유:  _를 안 붙임

 

'처음 배우는 프로그래밍(w.파이썬)' 카테고리의 다른 글

python  (0) 2021.02.23
사람이 이해하기 쉬운 코드를 작성하는 원칙  (0) 2021.02.23
휴보 바둑판 여는 코드  (0) 2021.02.23
약간 복잡해지기 시작하는 부분  (0) 2021.02.23
error  (0) 2021.02.22