Page 380 - Ai_417_V3.0_C9_Flipbook
P. 380
a=5 # is a simple statement where variable 'a' is created with value 5.
c=a + b
Multiline Statements
We can make a statement that extends over multiple lines. There are number of ways of making multiline
statement. Few are given below:
1. a = 4 + 5 +\
6 + 7 +\
8 + 9
\backslash helps you fit long calculations on multiple lines.
2. flowers =['Rose','Lily',
'Sunflower','Hebiscus']
3. marks =(10,25,16,
18,28,30)
Multiple Statements
Multiple statements represent more than one statement in a single line. This can be done by separating the
statements using semicolon (;).
a = 5; b = 10; c = a + b; print(c)
Tokens
Tokens are the smallest meaningful unit of a program. Python supports the following tokens:
• Keywords
• Identifiers
• Literals
• Punctuators
• Operators
Let us discuss each of these in detail.
Keywords
Keywords in Python are predefined and reserved words with special meanings and purposes and are not allowed
to be used as identifiers. We can see the list of the reserved keywords by giving the following command at the
Python command prompt:
>>>import keyword
>>>keyword.kwlist
Following is the list of keywords displayed by running the above commands:
['False', 'None', 'True', 'and', 'as', 'assert', 'async', 'await', 'break', 'class',
'continue', 'def', 'del', 'elif', 'else', 'except', 'finally', 'for', 'from', 'global',
'if', 'import', 'in', 'is', 'lambda', 'nonlocal', 'not', 'or', 'pass', 'raise',
'return', 'try', 'while', 'with', 'yield']
378 Touchpad Artificial Intelligence (Ver. 3.0)-IX

