Python language Fundamentals
Python character set:
Set
of character used in writing any python program is called python character set
It
is included with latin alphabets Arabic digits and symbols that are available
are available in the keyboard
a---z Latin Alphaberts
A---Z
0---9 arabic digits
, : () {}
[]
Python tockens:
Smallest
part of any python program is called a tocken. According to the nature these tockens are classified
into
1.
Keyword
2.
Identifiers
3.
Constants
4.
Operators
Keywords: These are Registerd words the meaning of which is defined by
the python interpreter totally there are 35 keywords available in python 3.7
Keywords must be written in small case because python is a case semstive
language
To display list of keyword in python
1.
Import
keywords
2.
Print
(keyword. Kwlist)
Identifiers it is the name with which we identify a variable, a function
a list or class
The following rules and code
convention must be followed while selecting an identifier
Rules
1.
Spaces are
not allowed
2.
Symbols
are not allowed with in and indentifier except under score (-)
3.
First
character must not be a digit
4.
Python
allows length of any size
5.
Keywords
can not be used as identifier
Example:
C language python
Int first; first
=45
Float second; second= 12.25
First =45; first
second
45 12.25
First =45;
second=12.25;
First second dynamic
typing
45 12.25
Static typing
Examples
India
First
Hello word
2nd
lang
Lang2
h.r.a
--450—
-hello
If
Break
---
PAK
CODE CONVENSION
1.
Name of
variable are, written in small case
2.
Constante
are defined in capital
PI=3.14
3.
Fuction
names are written in small case
Writelm () readlm ()
4.
Classes
most be in camel case
Index error,
runtime error
Constants :
these are the values stored in the computer memory the values of which cannot
be changed
In python constants are lilerals
are classified into
1.
Integer
constants
2.
Floating
point constants
3.
Boolean
constants
4.
Storing
5.
Nothing
constants
Example
A=40 d=10<20
b=12.25
c=hello e=name
0 comments:
Post a Comment