[필기노트] 연산에 대한 Python의 문법
1. 자연언어의 문법 : Subject Verb Object
Subject, Object have to be noun.
ex2> verb → eat, like
noun → I, Python, cookies
2. 프로그래밍언어의 문법 : Backus-Naur Form (배커스 나우어 형식)
* John Backus : Fortran의 창시자
<Non-terminal> → Replacement (most of these are Terminal, but some are Non-terminal)
>>모든 인자가 Terminal이 될 때까지 계속 Replacement를 실시한다
ex3>
Sentence → |
Subject → |
Noun → |
I |
|
+ Verb → |
like |
|
|
+ Object → |
Noun → |
Python |
3. Backus-Naur Form으로 살펴보는 수연산에 대한 Python의 문법 (Non-terminal and Terminal)
Expression → Expression Operator Expression
Expression → Number
Operator → + * - ÷(/)
Number → 0, 1, 2, 3, ...
Expression → (Expression)
ex4> Write Python code to print out how far light travels in centimeters in one nanosecond.
*speed of light= 299,792,458 m/s
meter = 100 centimetters
nanosecond = 1/1,000,000,000 second
ans> print 299792458*100/1000000000
4. Variables
(계속 작성)