27-02-24
----------
PYTHON INSTALLATION:
www.python.org
you go to download option
then you will find the latest python
version
you click on that latest version
button it will be downloaded
once its downloaded double click on
downloaded file and click next, next--finish
Data types in python:
Type() is a function used to know the datatype in
python.
Basic data types:
1. Numerical Datatypes
a) integers:
The numbers which does not have
any fractional part
ex: 10,2,346363,4737373,90
b) float:
The number which does have
fractional part
ex: 2.3, 5.5754,6.799
c) complex:
The number which is having real and
imaginary parts
a+ib
a- real part
b- imaginary part
syntax:
a+b*j
ex:
2+4j
2. Boolean: True or False
ex:
a=10
print(a==20)
ex:
a=10
print(a==10)
True
print(a==20)
False
type(a==10)
<class 'bool'>
type(a==20)
<class 'bool'>
3. Strings:
Collection of characters. It may enclosed in " "
or in ' '
ex:
s="hello"
type(s)
<class 'str'>
s1="abc123"
type(s)
<class 'str'>
s2="2432"
type(s2)
<class 'str'>
s3="1213@#$"
type(s3)
<class 'str'>
s4='abc12'
type(s4)
<class 'str'>
s5='''hello
this
is
also
string
only'''
type(s5)
<class 'str'>
s6="""this
is
one
more"""
type(s6)
<class 'str'>
Advanced datatypes:
1. Lists
2. Tuples
3. Sets
4. Dictionaries