0% found this document useful (0 votes)
54 views5 pages

Class 4

The document discusses Python versions, data types in Python, operators in Python, modules in Python, and identifiers and keywords in Python. It states that Python 1.0 was introduced in 1994, Python 2.0 in 2000, and Python 3.0 in 2008. It lists the main data types as integer, string, float, and provides examples. It describes different types of operators in Python including arithmetic, relational, logical, bitwise, and assignment operators. It discusses built-in and third-party modules. It outlines the rules for defining identifiers in Python and lists Python's reserved keywords.

Uploaded by

kunala
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views5 pages

Class 4

The document discusses Python versions, data types in Python, operators in Python, modules in Python, and identifiers and keywords in Python. It states that Python 1.0 was introduced in 1994, Python 2.0 in 2000, and Python 3.0 in 2008. It lists the main data types as integer, string, float, and provides examples. It describes different types of operators in Python including arithmetic, relational, logical, bitwise, and assignment operators. It discusses built-in and third-party modules. It outlines the rules for defining identifiers in Python and lists Python's reserved keywords.

Uploaded by

kunala
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

python version:-

python 1.0v introduced in jan 1994


python 2.0v introduced in oct 2000
python 3.0v introduced in dec [Link] order are preseved.
[Link] object are allowed.
[Link] are allowed.
[Link] in nature.
[Link] should be enclosed within squre [Link] Operators
[Link] or comparision operatos
[Link] OperatosNote:- raw_input function of python 2 is renamed as input()
function in python3.
Methods of dictionary:-
clear', 'copy', 'fromkeys', 'get', 'items', 'keys', 'pop', 'popitem', 'setdefault',
'update', 'values']
But in python3 we have only input() method and eaw_input() method is not available.

python 3 input() function behaviour exactly same as raw_input() method of py2 that
is every input value is treated as str type only.

Note:- raw_input function of python 2 is renamed as input() function in python3.


codule:- Module is a part of python program,there are 2 type of module
2n-built module(os,sys,math etc)
2rd party module(pandas,numpy,scipy,matplotlib etc)
[Link] Operatorsex:-
x = eval(input('First number:'))Note:- But in python3 we have only input() method
and eaw_input() method is not available.

python 3 input() function behaviour exactly same as raw_input() method of py2 that
is every input value is treated as str type only.

Note:- raw_input function of python 2 is renamed as input() function in python3.


Methods of dictionary:-
clear', 'copy', 'fromkeys', 'get', 'items', 'keys', 'pop', 'popitem', 'setdefault',
'update', 'values']
But in python3 we have only input() method and eaw_input() method is not available.

python 3 input() function behaviour exactly same as raw_input() method of py2 that
is every input value is treated as str type only.

Note:- raw_input function of python 2 is renamed as input() function in python3.

y = eval(input('second number'))
print(x+y)
But in python3 we have only input() method and eaw_input() method is not available.

python 3 input() function behaviour exactly same as raw_input() method of py2 that
is every input value is treated as str type only.

Note:- raw_input function of python 2 is renamed as input() function in python3.

india nai tiobk batuibkeej ubd indian arngudfoaoddofhsdsoihfodhfvx jjsddgf

10--->int
'scodeen'--->str
10.5--->float

Note:- But in python3 we have only input() method and eaw_input() method is not
available.

python 3 input() function behaviour exactly same as raw_input() method of py2 that
is every input value is treated as str type only.

Note:- raw_input function of python 2 is renamed as input() function in python3.

Output:-

we can write print() function to display output


[Link] Operatosindia nai tiobk batuibkeej ubd indian
arngudfoaoddofhsdsoihfodhfvx jjsddgf
10--->int
'scodeen'--->str
10.5--->float
in python3 we have only input() method and eaw_input() method is not available.

python 3 input() function behaviour exactly same as raw_input() method of py2 that
is every input value is treated as str type only.

Note:- raw_input function of python 2 is renamed as input() function in python3.


Operators:-

Operator is a symbol that performs certain operation,


Python proviede many operatos.

[Link] Operators
[Link] or comparision operatos
[Link] Operatos

Note:- But in python3 we have only input() method and eaw_input() method is not
available.

python 3 input() function behaviour exactly same as raw_input() method of py2 that
is every input value is treated as str type only.

Note:- raw_input function of python 2 is renamed as input() function in python3.


Methods of dictionary:-
clear', 'copy', 'fromkeys', 'get', 'items', 'keys', 'pop', 'popitem', 'setdefault',
'update', 'values']

1,clear:- Removes all element from the dictionary.

>>> s = {101:'Tushar',102:'Balaji',103:'Rupali'}
>>> [Link]()
>>> s
{}
10--->int
'scodeen'--->str
10.5--->float

ex:-
l = [10,56.87,7+9j,True,'string',[1,2,3,4],10]
>>> l
[10, 56.87, (7+9j), True, 'string', [1, 2, 3, 4]]
>>>

current versionNote:- But in python3 we have only input() method and eaw_input()
method is not available.

python 3 input() function behaviour exactly same as raw_input() method of py2 that
is every input value is treated as str type only.

Note:- raw_input function of python 2 is renamed as input() function in python3.


Operators:-

Operator is a symbol that performs certain operation,


Python proviede many operatos.
Note:- But in python3 we have only input() method and eaw_input() method is not
available.

python 3 input() function behaviour exactly same as raw_input() method of py2 that
is every input value is treated as str type only.

Note:- raw_input function of python 2 is renamed as input() function in python3.


Methods of dictionary:-
clear', 'copy', 'fromkeys', 'get', 'items', 'keys', 'pop', 'popitem', 'setdefault',
'update', 'values']

1,clear:- Removes all element from the dictionary.

>>> s = {101:'Tushar',102:'Balaji',103:'Rupali'}
>>> [Link]()
>>> s
{}

[Link] Operators
[Link] or comparision operatos
[Link] Operatos
[Link] Operators
[Link] Operatos
[Link] Operator.

python 3.9.5 10--->int


'scodeen'--->str
10.5--->float

Note:- But in python3 we have only input() method and eaw_input() method is not
available.

python 3 input() function behaviour exactly same as raw_input() method of py2 that
is every input value is treated as str type only.

Note:- raw_input function of python 2 is renamed as input() function in python3.


pyton 2.7.13

[Link] developing Desktop application.


[Link] developing web app.
[Link] developing database app.
[Link] Network programming.
[Link] developing games.
[Link] Data analysis application and data science.
[Link] machine learning.
[Link] AI(Artificial Inteligence) app.
[Link] IOT(Internet of things)
Limitation of python.

Identifiers

A name in python program is called identifiers.


It can be class name or function name or module name or variable name.

a = 10

class BankingProject:

def system_config:

Rules to define identifiers in python:-

1. The only allowed characters in python are

i. alphabet symbols(either lower case or upper case)


ii. digits(0 to 9)
iii. underscore symbol(_)

[Link] should not starts with digit

total123=(correct)
123total =(wrong)

[Link] are case sensitive . of course python lang. is case sesitive lang.

total = 10
TOTAL = 99
print(total)#10
print(TOTAL)#99

[Link]($) symbol is not allowed in python.

[Link] is no length limit python indentifiers,but not recommended to use too


lengthy indentifiers.

6. using underscore symbols:-

x = 10 (normal variable)
_x = 10(procted variable)
__x = 10 (private variable)
___x = 10 (magic variable)

Reserved words or keywords

In python some words are reserved to represent some meaning or functionality. such
type of words are called Reserved words. There are 35 words are reserved in python.

'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'
Note:-
[Link] can not use variable or class or function or module name as a keywords name.

ex:-True = 10(worng)'
[Link] Reserved words in python contain only alphabet symbols.

[Link] the True,False,None 3 reserved words ,all contains only lower case
alphabets symbols.

process of keywords

import keyword
[Link]

'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'

You might also like