Getting started with python
1)
Interactive mode Script mode
In interactive mode, commands In script mode, the Python
are entered one at a time program is written in a file. The
The output is displayed program is saved with the .py
immediately after pressing the file extension.
Enter key. The file can be saved and
The output depends on the last executed using the command
command entered prompt.
It is convenient for writing It is suitable for writing long
short programs. programs.
2)
Python is a high level language: means its programmer-friendly i.e.,
easy to program and comprehend
Python is an interpreted language: means it requires a interpreter (not
compiler) to execute its code line by line- one statement at a time.
3)
Python Character set: Is a set of characters a language can recognize. It
can be any letter,digit,or any special character.
Python supports Unicode encoding standard
Python has the following Character set:
o Letters : A-Z , a-z
o Digits : 0-9
o Special characters: space + - * / \ ** = () [] {} // != < > == ‘ ‘’
‘’’ , : ; % ! & ~ @ __
line ,form feed .
Whitespaces: blank spaces, tabs(), carriage return (↩),new
4)
Tokens: In a passage of test the individual words or punctuators are called
tokens or lexical units or lexical elements. Tokens or lexical units are the
smallest unit in a program
Python has the following tokens:
Keywords are special words with a specific meaning and function.
Python has a fixed set of [Link] user cannot create their
Keywords own keywords.
Example: if,elif,else,for,while,True,False,None,etc.
Keywords are strictly lowercase except ; True,False and None
Identifiers are names made by the user which can be given for
variables,functions,etc.
Identifiers Identifiers may include ; letters,digits and underscore. But they
must strictly begin with either a letter or an underscore
Example : Apple1 , word_, _hi245
Is a fixed numeric or non-numeric value that may be a number,text
or other data that represents a value.
Literals It is stored in variables.
Example: 2, 2.36 , ‘abc’ etc
An operator is a symbol or a word that performs some kind of
Operators operation on given the values and returns a result.
Examples of operators are : + - * /
Punctuators are symbols which can be used to separate values or
Punctuators to enclose values.
Examples: () [] {} ; :