The Zen of Python, by Tim Peters
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
print (출력)
첫 단원에서는 기본 print() 의 출력만 배웁니다.
향후 실습 진행을 위한 정도만 배우고, 나중에 문자열 포맷팅에서 더 자세히 다룹니다.
print('오늘 파이썬 배우기 좋은 날이네!')
오늘 파이썬 배우기 좋은 날이네!
print("오늘은", "일요일")
오늘은 일요일
print(1, 2, 3, 4)
1 2 3 4
Jupyter Notebook 셀에서 맨 끝에 위치한 변수, 문자열, 숫자등은 자동으로 출력합니다.
3.14, ‘안녕’, 100 이렇게 3개의 값이 있지만, 항상 가장 마지막만 출력됩니다.`ㅡ
3.14'안녕'100
100
변수 (Variable)
변수는 데이터를 담는 그릇이라고 생각하시면 됩니다.
변수라는 그릇에 정수를 담을 수도 있고, 긴 글을 담을 수도 있고, file을 담을 수도 있습니다. 우리가 재사용 하기 쉽게 별명을 지정해 줬다라고 쉽게 생각하시기 바랍니다.
변수의 이름 규칙 (Rule)
다음의 문자만 사용할 수 있습니다. - 소문자(a~z) - 대문자(A~Z) - 숫자(0~9) - 한글도 가능 - 특수기호는 언더바(_) 만 허용
다음의 규칙을 가집니다. - 대소 문자를 구분합니다. - 숫자는 맨 처음에 올 수 없습니다. - 예약어(keyword)는 사용할 수 없습니다. (def, if, del, import, return 등등)
case 1. 알파벳 (가능) / 대소문자 모두 가능 /심지어 한글도 가능하나 사용하는 것은 비추!