good/Language
Python 특징
coodnoob
2009. 12. 18. 23:14
- the high-level data types allow you to express complex operations in a single statement;
- statement grouping is done by indentation instead of beginning and ending brackets;
- no variable or argument declarations are necessary.
이런 이유로 코드가 짧아지고 가독성이 좋아질 수 있다.
주석
#으로 시작한다
라인 앞이나 뒤에 와야댐 스트링 문자 뒤에 오면 지지
Some examples:
# this is the first comment
SPAM = 1 # and this is the second comment # ... and now a third! STRING = "# This is not a comment."
조건,반복
>>> # Fibonacci series:
... # the sum of two elements defines the next
... a, b = 0, 1
>>> while b < 10:
... print b
... a, b = b, a+b
...
1. 변수 동시선언 가능
2. 루프안은 같은 범위로 들여쓰기( tab이나 space로)
A trailing comma avoids the newline after the output