clacstec
Dcie
Basic PYTHON Notes NOTE : hexe /s no use Of Cusly braCes ox
AUL UMAR
Semicoloni n python prog7aMmin g
NoTES 4ALLErY |anguage.
Nhat is a Python
Python is a simee, hign level, qenexal. Rathon tYst Program AUL MR LUNKEPN).
NOTES GALERY TeLE;EAM).
purpose and obËect - Oriented PYOgraMMing
language KograM for Print Heilo norld
hy leayn Puthon Print"Hello aNorld"
EGSy to use Qnd earn
Expresslve anguage. Puthon PopulaY rameworKS and ibYaries
C
Intexpretedlanguage
|Object-Oyiented 1anquage. |eb Development : D Janao f1ask_ lyYamid
Open sOuYCe |anguage Chersy Py.
Extensible
Embeddable GUIS based Applications : TK, PyGTK, PyQT,
Dynamic MemoYy Allocatlon PyTS.
"Cqur Programming suppoxt.
Machine |easning : Tensorfow yToYch
Py
where is Puthon used? Scikit- learn etc.
Dara science Mathematics : Numpy
Nympy pandgS etc.
Dara Mining
Desktop Applicatons Puithon axiables.
Mobile Applications.
web Applications Python Variable is a nane that is used to
Machine learninag refer toD MeMory 10carion. Pytnon vaxiable
3D CADApplications is alsO Knon as identiCiex and used to
SpeechRecognitlons hold alue:
classMate
classMate
Date
Date
Page
Page
The for loops
n n python, Ne don't need to specify the type AFox l0op is used foY iterating over a
f yaiable b ecause puthon is an inFer Sequence . It is fyequently used to traverse
|language and smart
Smart enough to qet variable the data structures like ist_ , tuple or
type. dictiongry
Examples: The syntax of Fox lo0p:
|| Tnteger Data Tupe.
b ="vedant" || Character Data Type. or iteyating - var in sequence
U 80.50 || Aloat Dara Type Sttement (S)
print (a) Example i
priot (b) S+Y= Vedant
Pyint (u) AtuL kuMAL(LINKEPN) foY i in stx:
NOTES GALeKYTELEYRA) Print(i)
Output :
5
Vedent Outpyr: AUL eMR LINKEDIN).
80.50 NorES GALLeRY(TELE4RAM).
Python 10ops. a
The while loops t
witn the mhile lo0p e can
execute a Set of Starements as long as Q
condition is tyue
Exgmele:
aqe int(input("Enter your Age"))
Example age
while i<6:
prlnt (i) print("you qre eligible to vote")
else:
3. print("yos are No eligible to vote" 4.
classMAte cAssMate
Date Date
Page Poge
The elif stQtement
Suntax
Ihe eli stateMent aye used to check Multiple def [Link](Paraqmeters) :
Conditions and executes the specific block unctlon - blocK
OF statements dependin upon the tue etuYn Expression.
Condition aMOng them.
ATuL KMALUNKGDIN). AuL aMM LINKEDIN)
NOTES YMLERY (TeLRAM)
Suntax TE ConditlonS:
ExaMple : NOrES GAMUeYGEEYRAM).
def suM(): # Defining funcion
# block of Statements
eif condition : b= 20
*blocK of Starements
elif conditBon 3: xeturn c
# blocK of Statemens
elif condition 4i #Calin sum function in pxint
statement
# blocK of Sratements print("The sum is :", suMO)
else
Rython function Pthon Arxays
An array is ga collection of a similay tupe
Pathon function axe the Most iMpoxtant Of data and stored it into the contiaues
aspect of an application. A Function can be MemoÝy 10cqtion THe îndex of an array
setined as the oxagnized blocK of is starting nith Q I ee can access each
xeusable code, mhich can be caled element via itsjndex.
Jnhen evey required
Tne Array can be cyeated in python by
Cyeating function. iM20ring the aYYay Module to the
Python provides the def Keyword to define python program.
the function. The syntax of the de Cine
Funcion is GiVen below
5. 6
clhssmta.
Date
Date
IMALUNKEPIN).
AruL
Examplei
tyom ExqMple
aXYay
íMpoxt
*
arraylTypecode,[initalizers]).
Hello".
=
AvYayName
=
Str
Lo])
Print(sty
L1])
Print(Sty
arr
as
avYayprint("yst
iMport
E
[2])
9)
=[Link]('i,C2,4,6.
Pslnt(&t
q to)
[3])
Print(Sty
eleMent:"a
L
element:"aLI])
[4])
Print(S
ty [5])
print("Second
(&th
Print
LINKEPIN).
KUMAR
ATUL
NOTGS
GPLEKY(TELELAM).
Qurpur
Stina
:element
2
Operators
FiYst
:
4
elementSring
Second
t E
Concatengte
the
two
string
J’OAccess
the used
sub-Stzings
Of
a
Python
2atticulay
string
/.
Tt
is
to
pexfoM 55
Sting
the
of
Poxmatting
collection
String
thesingle
is
Python
charactexs
suxounded Hi
by
quotes,
double
quores
ox
Oubeut:
triple
quotes vedant
=
number
enteyO
Syntaxi
Sum
is
[0.
(
Sty
=
String
indexing