PYTHON — FULL
COURSE
Python.
@ LTrtoductio
Python js q@ Cyoss - Plarfoxm_ pPyo9vamming Language,
which means thar it can vun on Multtple plarforms.
UKe yrindows InuxX, aNd has been even
proted {0 the_fova and -NET_vivtual ines. It ts
Free and open- Source.
Atul kemar (Linkedin):
NOTES GALLERY (TELEGRAM),
@ Your Fivst Python program.
Lets create @ very simple progyam called ‘Hello orld’
Type the following code fn editor oy an IDE and Save
it as _hello_ world. Py_- :
(Pxint C'neulo, world! "))
You willl get the Potjowing Output.
Hello, Wosld
AS you Can see, this Was a_pvetty easy tack. TAle
Ts the beauty of the python progvamming_@ Python Keywords |
Keyword ave the_yesovved Word in python:
We cannot use A Keyword as a vawviable name,
function name oy any Other identifers.
They aye use to define _ Syntax and structure of
the python language.
Fase Pass
yale
hon 16eal
Pacer | der] aiobar_| not _|
Gieis.
All the KeyWords except_Ivue, False and None
are tn 1oWer case and they must be Written as
they are.
@ PYthon Identifiers :
An §dentifiers fs a name Qiven to entities Uke
Class, Funutlons, vartables , ete.
KeyWord cannot be used as identiflersFrie “< interactive input >", ne 1
lobal = 1: seer oleae eau aes |
A
| Sgntax evvor: Invalid Syntax |
| ee cee
We cannot uce special Symbol like | , @ #4, 1
ett., In our identifier.
a@=0
Arul Kumag (unKeDiny) .
Frie “< fntevactive input >", linet
Syntax Exvor: invalid Syntax
@ Syntax of function :
def function. name (Parameters ):
docst ying" ou
Statement CS )
wow® Example of a function:
def qreet (name):
that tt
This Function greets to
the Person Passed tn as
a Pavameter
Wt tt
Print (“Heilo, “tname t " Cood Moxning!”)
NOTES eareea CTELEGRAPD,
@ How to call a function in Python?
>>> greet (‘Pau ')
Hello, Paul. Cyood Morning |
PYTHON OBJECT ORIENTED PROGRAMMING
— Class:
Pass
—> Object:=> Methods:
Methods ave Functions defined jnside the
body pF 4 class. They Ave used to define the
behaviours of an Object.
=> Inhevitance:
Inhevitance js Q wioy of creating
@ ned class for using details of an existing class
without modifying it. The newly formed class 1s derived.
=> Encapsulation:
Using OOP fn python, We can xesteict
Access t) methods and ya@yiable- Jnis prevents data
From direct modification .
= _Polymoxphism:
It fs an abidty Cin oop) to use 9
Common InterFace for multiple forms (data type).
NOTES GALLERY (CTELEGRAYW)
INBUILT DATA STRUCTURE
'
@ Creating alist:
4] My_iist =0J 4 creating empry tist.
_2| Print (mg ttst)
_3-|My_ ist = £1,2,3 ‘example, 3.132) # Creating list
4} print (my_ List) With data.e Cweating a dictionary ;
4,| My- dict = {) # empty dictlonary .
2| Paint (My_ dict)
_3-|My_diet= (4: ‘Python’, 2: ‘Java'> 4F dictfonary with
el *
4 | paint UMy_aict) cosa
ATU KOMARLLINKEDIN) »
= NOTES LERY (TELE
@ Cveating a tuple Cae
4.) My_ tuple = (1,2,3) ## Create tuple
2. | Print (My_ tuple)
@ Creating a set
4, | My-Set = €1,2,3,4,5,5,5 } # Create set
2. Print (My- Set.