Python Notes
Python Notes
1. data type :
3. Type of operators
+ ( sum )
- ( difference )
* ( multiply krna )
/ ( divison )
% ( remander nikalna ) - modulo bolte hai ise
** ( power operator ) eg ( a**b so a^b )
in sb ka data type boolean hota hai and last ke jo do hai usme agr ek bhi sahi hua
toh code true hoga jb run krenge .
= ( equals to ) eg a= 20
+= ( plus equals to )
-= ( minus " )
*= ( multiply " )
/= ( divide " )
%= ( remainder " )
**= ( power " )
2nd se lekr last tk in sb me ye hota hai do values hongi unke sath operations kro )
same naam ki
eg for += : Num = 20
eg for ** : num = 3
: num = 6
( num**= )
print("num":, num )
1st) not ( agr true & false ke aage not lga denge toh uski opposite value dega ) ye
single value pe kaam krta h )
not T = False
not F = True
2nd) and ( do values pe kaam krta hai ) hindi me mtlb iska AUR
: ye true ans tbhi deta hai jb dono values sch hoti hai ( this is imp*****)
: agr dono vale me ek hi value false hogyi toh ans false ho jayega
: dono me ek bhi values sahi hue toh toh ye ans true dega(this is imp*******)
4. \n is a escape squence jiska mtlb hota hai next line agr kisi string ko hume do
line me convert krna hai toh bich me lga do .
\t se tab ka space aa jayega mtlb sentence ke bich space aa jayega .
isi ka dusra tarika hai ki hum use kre build in data type mtlb data ko unke samne
unka data type likhkr tuple ki form me store kra dena
eg. values = {
("float" , 9.0 )
("int" , 9 )
}
print(values)
31. loops me variable ko iterators bolte hai and loop 1 bari complete hona usko hum
iteration bolte hai .
31. traverse means hum ek ek element ke uper jare hai or travel kr rhe hai or usko
print kr rhe hai while loop lga kr .
32. continue in while loop act as skip . ye ek chiz ko skip kr dega and next pe
pahuch jayega ( or simple ignore kr dega ) .
33. range me ending number include nhi hota . eg print(range(5)) then 0 ,1 ,
2 ,3 ,4 print ho jynge but 5 nhi aaya.
34. range me step mtlb increment kitne se increase kr rha hai .
35 range me start ki value included hoti hai but stop ki value included nhi hoti .
36. pass mtlb loop ke ander koi kaam nhi krana toh vo chiz use skip krdega and next
kaam pr work krega .
37. redundant means to repeat .
38. jo function input leta hai use hum paarameter bolte hai or kuvh output return
krta hai .
39. jab hume function ko call krna hota hai toh hum function ka naam likhte hai and
usme kuch argument dalte hai and these argument going to store in parameters
40. loop and recursion same hi hote hai jo kaam hum recursion se kr skte hai vahi
kaam hum loop se bhi kr skte hai .
41. jab bhi hum multiple statement ko same line me print krna chahte ho tb end = "
' ye daldo .
42. built in function vo hote hai jo phele se define hote hai python me .
43. jo function user lihte hai use hum user defined function kehte hai .
44. defauts parameter vo hote hai jb hum koi function call krre hote or usme
argument nhi hoti hai toh hum main function ke parameter me kuch value khudse de
skte hai eg def function(a = 2,b=7)
45.