-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPython.txt
More file actions
891 lines (643 loc) · 22.8 KB
/
Python.txt
File metadata and controls
891 lines (643 loc) · 22.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
* Python is a Multi-purpose programming/General purpose language
* Created by "Guido Van Rossum" in 1989
* IDLE = Integrated Development and Learning Environment
* Indentation is very very important in Python - One tab equals to 4 spaces by default
* We should use all lowercases for naming 'variable' and 'functions' && underscore(_) to differentiate to words
* We should follow Pascal naming convension while creating class
Pascalcase: The fisrt letter of every word should be uppercase. And we shouldn't use underscore(_) to differentiate to words
* PEPs = Python Enhancement Proposals
* We never use complex number (1 + 2j) in web development
* When a function is part of an object, we refer to that function as a method
* comprehension syntax is below
[expression for item in items]
* PYPI --> Python Package Index, It's like NPM. It's basically a repository of Python packages which are built by developers across world.
* We can install PYPI packages using command line as below
pip install requests
Note: We can install a specific version of a package as below
pip install requests==2.9.0 (OR) pip install requests==2.9.* (OR) pip install requests~=2.9.0
* We can un-install a package using command line as below
pip uninstall requests
* We can know the installed packages by below command
pip list
* Docstring is indicated by 3 double quotes (""") - Example is below
""" One line description
A more detailed explanation
"""
Note; Above one is called as 'Multi-line doc sting'
*********************************** Useful VScode Extensions ********************************************
* Python by Microsoft
* Code Runner by Jun Han - It's a read-only use - We shouldn't python files with this extension if that files contains 'input' function(s). Because this extension is used only for output but won't work for taking input values.
******************************************** Errors *****************************************************
*** An exception is a kind of error that terminates the program
* Syntax error is like grammer in general language
>>> 2 > [Enter] --> this gives Syntax error
* If we try to access a key from a Dictionary which doesn't exist, then we get 'KeyError'
* If we try to access a value with index from a list which doesn't exist, then we get 'IndexError'
* If we try to divide an integer value with ZERO, then we get 'ZeroDivisionError'
* If we enter a string value instead of Number in input() then we get 'ValueError' - below
num = int(input("Enter Age: "))
Note: To handle errors/exceptions we need to use 'try expect' way as below
try:
file = open("app.py")
num = int(input("Enter Age: "))
except ValueError as ex:
print("You didn't provide a valid age")
print(ex)
print(type(ex))
except (ValueError, ZeroDivisionError):
print("Enter valid age")
except ZeroDivisionError:
print("Age can't be 0")
else:
print("No exceptions were thrown")
finally:
file.close()
print("Execution continues...")
Note: 'else' will be executed only if there are no errors/exceptions & 'finally' will be executed always
* The 'with' statement
try:
with open('app.py') as file, open('another.txt') as target:
print("File is opened")
Note: If we open a file using 'with' statement, then that file will be closed automatically no matter whether 'try' has 'finally' or not
Note: The 'with' statement automatically releases external resources
* Raising own eceptions
We can raise own exception with 'raise' statement, example is below
def calculate_xfactor(age):
if age <= 0:
raise ValueError("Age can't be 0")
return 10/age
try:
calculate_xfactor(-1)
except ValueError as error;
print(error)
Note: By convention all custom exceptions should end with 'Error'
Ex: InvalidOperationError
Note: Everytime you wanna create a custom exception we should derive our class from built-in 'Exception' class
class InvalidOperationError(Exception):
pass
Note: We have many type of exceptions in Python, just google 'Python 3 exceptions'
*************************************** Telsko playlist *************************************************
* BODMAS rule
* Operator precedence = That determines the order in which is order apply
* 5/2 = 2.5
* 5//2 = 2
Above thing is called as Integer/Floor division
* 2**3 = 8
Above thing is POWER - 2 power 3
* 10 % 3 = 1
Above thing is Modular/remainder
* 5*'Manoj' = "ManojManojManojManojManoj"
* print("c:\doc\navin");
c:\doc
avin
Here '\n' means NEW line
* print(r"c:\doc\navin"); = c:\doc\navin
Above thing is called as 'Raw String'
* underscore(_) holds the value of previous operation
* name = 'youtube'
name[0] = 'y'
name[-1] = 'e'
name[0:2] = 'yo'
name[1:4] = 'out'
name[1:] = 'outube'
name[:4] = 'yout'
name[3:10] = 'tube'
* len(name) = 7
*
****************************************** Datatypes ******************************************
* None
* Numeric
-> int
-> float
-> complex
x = 1 + 2j
-> bool
* List
* Tuple
* Set
* String
* Range
* Dictionary (Map)
=======================================================================================
* LIST
--------------------------------------------------------
numbers = list(range(10))
print(numbers[::2]) ==> [0, 2, 4, 6, 8]
* To reverse a list
print(numbers[::-1]) ==> [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]
* Unpacking the list
numbers = [1, 2, 3, 4, 5]
first, second, tird, four, five = numbers
Note: There should be same number of variable as list contains
first, second, tird, four = numbers ==> This gives error
but we can achieve it in other way as below
first, second, *other = numbers
but if we want to get first & last variables, it's as below
first, *other, last = numbers
Note: If we want index also, we need to use enumerate function
* Iterating list
letter = ['a', 'b', 'c']
for letter in enumerate(letters)
index, item = letter
print(letter[0], letter[1]) ==> (0, a) then (1, b) then (2, c)
Note: Above thing can also be re-written as below
for index, letter in enumerate(letters)
print(index, letter)
* If we want to add items to list at an end, we should use 'append()'
list.append('d', 'e')
* If we want to add items at a specific position to list at an end, we should use 'insert()'
list.insert(0, '-')
* If we want to remove items from a list at an end, we should use 'pop()'
list.pop()
Note: If we don't pass an index in pop method, by default 'pop' method removes last item from the list
* If we want to remove items from a particulat position from list, we need to pass index
list.pop(0)
* If we want to remove items from a list and we don't know the index, then we can use 'remove()' method
list.remove('b')
Note: this will remove first occurence of the letter 'b' from the list. But if want to remove all occurences in the list, then we should iterate the list and apply remove() method in the loop
* We can delete multiple item at a time from list as below
del list[0:3]
* To get an index of an item from an item, then we can use 'index()' method
list.index('b')
Note: If we try to get an index of an item which doen't exist in the list, it gives error but not '-1'
So the better and good way to get an index is as below
if 'b' in letters:
print(list.index('b'))
Note: The other way is knowing the number of occurences of an item in the list
print(letters.count('b'))
* We want to delete all the item from a list, then use 'clear()' method
list.clear()
* We can sort a list in accending order as below
list.sort()
Note: The other way is as below
sorted(letters)
Note: The diff is list.sort modifies the original list whereas 'sorted()' doesn't
* We can sort a list in deccending order as below
list.sort(reverse=True)
Note: The other way
sorted(letters, reverse=True)
* We can sort a list which contains tupple as below
items = [
("Product1", 9),
("Product2", 10),
("Product3", 12),
]
def sort_item(item):
return item[1]
items.sort(key=sort_item)
print(items)
Note: The above thing with lambda function way
items.sort(key=lambda item:item[1])
print(items)
=======================================================================================
* TUPLE
------------------------------------------------------------------------------
Note: Tuples are immutable, means they can't be changed once created, so we Tuple won't contain 'append()' and 'remove()' and other add & removable methods
* Tuple is created with or without '()'
Ex: tuple = (1, 2, 3) || tuple = 1, 2, 3
Note: If it contains only one property then
tupe = (1) || tuple = 1,
* Concatenating two tuples
tuple1 = (1, 2, 3)
tuple2 = (4, 5, 6)
combinedTuple = (1, 2, 3) + (4, 5, 6) ==> (1, 2, 3, 4, 5, 6)
* Multiplyinh tuple
tuple = (1, 2, 3)
multipliedTuple = (1, 2) * 3 ==> (1, 2, 1, 2, 1, 2)
* Converting List to Tuple
point = tuple([1, 2, 3]) Also tuple("Hello World")
* Unpacking tuple
tuple = (1, 2, 3)
x, y, z = tuple
=======================================================================================
* ARRAY
---------------------------------------------------------------------
* To create an array we need to import 'array' from 'array' module
from array import array
Note: We should use 'array' only if we are about to dealing with large sequence of numbers and encoutering performance problems
Syntax: array(typecode, iterable)
numbers = array('i', [1, 2, 3])
=======================================================================================
* SET
---------------------------------------------------------------------
* Set contains only unique values
Note: We can't access 'set' items with indexed like we do with 'list' because 'set' is un-ordered collection of unique items
Syntax: uniques = {1, 2, 3, 4}
* We can make 'set' from a 'list'
numbers = [1,1,2,3,3,3,4,]
uniques = set(numbers) ==> {1,2,3,4}
* first = {1,1,2,3,4}
second = {1,5}
print(first | second) ==> {1,2,3,4,5}
print(first & second) ==> {1}
print(first - second) ==> {2,3,4}
print(first ^ second) ==> {2,3,4,5}
*
=======================================================================================
* DICTIONARIES
---------------------------------------------------------------------
Syntax: point = {"x": 1, "y": 2, "z": 3}
we can also use 'dict' method and passing 'key=word' argument way as below
point = dict(x=1, y=2, z=3)
* We can access properties in 'Dictionary' with 'key'
print(point['x'])
Or wen use 'get' method access properties in 'Dictionary' with 'key' as below
print(point.get("x")) ==> 1
but, if we try to access a key which doesn't exist with 'get' method, then it returns 'None'
print(point.get("aaa")) ==> None
Here, we can pass default value also as below
print(point.get("aaa", 0)) ==> 0
* Changing item
point['x'] = 10
* Deleting item
del point["x"]
* Looping through Dictionary
for key in point:
print(key, point[key])
another way is below
for key, value in point.items():
print(key, value)
* Way to create Dictionary
values = {}
for x in range(5):
values[x] = x * 2
Above thing can also be re-written as below with comprehension
values = {x: x * 2 for x in range(5)}
************************************** Comprehension *******************************************
* comprehension syntax is below
[expression for item in items]
* comprehension can be used with 'list', 'set' and 'dictionary' but not with 'tuple' - but if we use comprehension with 'tuple' then we will get 'generator object'
****************************************** Operators ******************************************
* Argumented assignment operator
x = 3
x += 2 # this is called as 'Argumented assignment operator'
* Assignment operator -> a,b = 5,6
* Unary operator
n = 7
n = -n // -7 will be assigned to 'n' variable
* Logical operator
a = 5
b = 4
a < 8 and b < 5 ==> True
a < 8 or b < 5 ==> True
x = True
not x ==> False
* print('*' * 5) ==> '*****'
* print([0] * 5) ==> [0, 0, 0, 0, 0]
* letters = ['a', 'b', 'c']
zeros = [0] * 5
combined = zeros + letters
print(combined) ==> [0, 0, 0, 0, 0, 'a', 'b', 'c']
* print(list(range(5))) ==> [0, 1, 2, 3, 4]
* Logicaloperators --> In Python logical operators are short-circuit evalution
hight_income = True
good_credit = True
student = True
-> and
if hight_income and good_credit:
print("Eligible")
else:
print("Not eligible")
-> or
-> not
if (hight_income or good_credit) and not student:
print("Eligible")
else:
print("Not eligible")
* Chaining comparision operators
age = 22
if age >= 18 and age < 65:
if 18 <= age > 65:
print("Eligible")
********************************** Some in-built functions ******************************************
* len()
* type()
* int()
* float()
* bool()
10 == '10' ==> False # B'coz they both have diff datatypes
"bag" > "apple" ==> True
"bag" > "BAG" ==> False
* ord() # this is used to get the order of char Ex: ord("b") ==> 98, ord("B") ==> 66
* str()
* complex()
* dictionary.keys()
* dictionary.values()
* bin(25) ==> 0b1101 --> convert Decimal to Bynary system
* oct(25) ==> 0o31 --> convert Decimal to Octal system
* hex(25) ==> 0x19 --> convert Decimal to HexaDecimal system
* eval() --> Evaluates an expression which is entered in input()
*
String Functions:
-------------------------------------------------------------------
course = "Python Programming"
* course.upper()
* course.lower()
* course.title()
* course.strip()
* course.lstrip()
* course.rstrip()
* course.find("Pro")
* course.replace("p", "j")
* print("pro" in course)
* print("swift" not in course)
Number Functions:
-------------------------------------------------------------------
* print(round(2.9)) ==> 3
* print(abs(-2.9)) ==> 2.9
List Functions:
-------------------------------------------------------------------
items = [("product1", 10), ("product2", 9), ("product3", 12)]
* prices = list(map(lambda item: item[1], items))
* filtered = list(filter(lambda item: item[1] >= 10, items))
-> List comprehension
we can re-write above 'map()' with List comprehension as below
* prices = [item[1] for item in items]
we can re-write above 'filter()' with List comprehension as below
* prices = [item for item in items if item[1] >= 10]
-> We can use 'zip()' to join two Lists to combine as list of tuple as below
list1 = [1, 2, 3]
list2 = [10, 20, 30]
zippedList = list(zip(list1, list2))
print(zippedList)
********************************** Statements ******************************************
* IF statement
temperature = 35
if temperature > 30:
print("It's a hot day")
print("Drink plenty of water")
elif temperature > 20:
print("It's a nice day")
elif temperature > 10:
print("It's a bit cold day")
else:
print("It's cold day")
print('done');
* Terinary Operator
age = 22
message = "Eligible" if age >= 18 else "Not eligible"
* RANGE
numbers = range(5, 10, 2)
for number in number:
print(number)
* WHILE loop
number = 5
while number <= 5:
print(number)
number = number + 1
* FOR loop
numbers = [1, 2, 3, 4, 5]
for item in numbers:
print(item)
* FOR ELSE loop
successful = False
for number in range(3):
print("Attempt")
if successful:
print("Successful")
break
else:
print("Attempted 3 times and failed")
* Nested loops
for x in range(5):
for y in range(3):
print(f"({x}, {y})")
******************************************** Modules ******************************************
* A module is like a separate file with some Python code
* 'math' module includes lots of mathemetical functions for working with numbers
* import math || from math import sqrt, pow
math.sqrt, math.pow
* import sys
sys.argv
* from collections import deque
Note: 'deque()' is used to remove items one by one from left as below
list = [1, 2, 3]
print(deque.popleft())
* from array import array
* from sys import getsizeof, argv
* from pprint import pprint
* from timeit import timeit
* from collections import namedtuple
* import csv
* import json
* from pathlib import Path
* import sqlite3
* import time
* from datetime import datetime, timedelta
* import random
* import string
* import webbrowser
* import email.mime.multipart from MIMEMultipart
* import email.mime.text from MIMEText
* import email.mime.image from MIMEImage
* import smtplib
* from string import Template
* import subprocess
******************************** Custom function defining **************************************
* All functions by default returns 'None'
* def greet(first_name, last_name):
print(f"Hi {first_name} {last_name}")
print("Welcome aboard")
greet("Manoj", "Kumar")
* def get_greeting(name):
return f"Hi {name}"
greet_message = get_greeting("Manoj Kumar")
print(greet_message)
* def increment(number, by):
return number + by
print(increment(2, by=1))
Note: Above "by=1" is called as 'Keyword Aguments
* DEFAULT ARGUMENTS
Note: All optional parameters should come after required parameters
def increment(number, by=1):
return number + by'
print(increment(2))
print(increment(2, 5))
* XARGS
def multiply(*numbers):
total = 1
for number in numbers:
total *= number
print(number)
return total
print(multiply(2, 3, 4, 5))
* XXARGS
def save_user(**user):
print(user)
save_user(id=1, name="John", age=22) ==> {'id': 1, 'name': 'John', 'age': 22}
****************************************** Scopes ******************************************
* There are 2 types of scopes
1) global
2) local
* variabes which are defined outside of a function will have global scope
* variabes which are defined inside of a function will have local scope
We can change global scope variable value as below
message = 'Hello'
def greet(name):
global message
message = 'World'
greet("Manoj")
print(message) ==> World
****************************************** Excercises ******************************************
* FizzBuzz algorithm
def fizz_buzz(input):
if(input % 3 == 0) and (input % 5 == 0):
return "FizzBuzz"
if(input % 3 == 0):
return "Fizz"
if(input % 5 == 0):
return "Buzz"
return input
print(fizz_buzz(15))
* sentence = "This is a common interview question"
char_frequesncy = {}
for char in sentence:
if char in char_frequesncy:
char_frequesncy[char] += 1
else:
char_frequesncy[char] = 1
pprint(char_frequesncy, width=1)
print(sorted(char_frequesncy.items()))
print(sorted(char_frequesncy.items(), key=lambda kv: kv[1]))
print(sorted(char_frequesncy.items(), key=lambda kv: kv[1], reverse=True))
char_frequesncy_sorted = sorted(char_frequesncy.items(), key=lambda kv: kv[1], reverse=True)
print(char_frequesncy_sorted[0]) ==> ('i', 5)
************************************** Unpacking Operators *********************************************
-> '**' is Unpacking Operator for Dictionaries
-> '*' is Unpacking Operator for other datatypes
************************************** Differences *********************************************
* Difference B/W 'set' & 'dictionary' is - 'set' will have only keys as below
set = {1 2, 3}
'dictionary' will have key-value pair as below
dictionary = {'x':1, 'y':2, 'z':3}
Note: Both 'set' & 'dictionary' uses curly braces to create
************************************** OOPs *********************************************
* Class = bluprint for creating new objects
* Object = is an instance of a class
Note: All the methods that are defined in a class should have at least one parameter. By default it's 'self'.
'self' is a reference to a current object.
* Classes in Python will have 'Magical Methods'. All Magical methods starts & ends with double underscore(__methodname__)
* Magical methods are
__init__ --> It's nothing but a constructor
* We should follow Pascal naming convension while creating class. Syntax is below
class MyPoint:
def draw(self):
print("Draw")
point = Point()
print(type(point)) ==> <class '__main__.Point'>
print(isinstance(point, Point))
* We can use 'isinstance()' to check whether an object is an instance of a class or not, as above
* We can use 'isinstance()' to check whether a variable is an instance of 'int' or not, as below
print(isinstance(point, int))
* INHERITANCE
class Animal:
def __init(self):
self.age = 1
def eat(self):
print("Eat")
class Mammal(Animal):
def __init(self):
self.weight = 2
super().__init__()
def walk(self):
print("Walk")
class Fish(Animal):
def swim(self):
print("Swim")
print(isinstance(m, Mammal))
print(isinstance(m, object))
print(issubclass(Mammal, Animal))
* class Animal:
def eat(self):
print("Eat")
class Bird(Animal):
def fly():
print("Fly")
class Chicken(Bird):
pass
Note: Above concept is 'Multi-level inheritance'
* MULTIPLE INHERITANCE
class Employee:
def greet():
print("Employee greet")
class Person:
def greet():
print("Person greet")
class Manager(Employee, Person):
pass
manager = Manager()
manager.greet() ==> "Employee greet"
* ABSTACT CLASS
from abc import ABC, abstractmethod
class UIControl(ABC):
@abstract
def draw(self):
pass
Note: Any class that inherits 'UIControl' class, then that class must should define 'draw' method
* Extending built-in types
class Text(str):
def duplicate(self):
return self + self
text = Text("Python")
text.duplicate() ==> PythonPython
* Data classes
class Point:
def __init__(self, x, y):
self.x = x
self.y = y
p1 = Point(1, 2)
p2 = Point(1, 2)
print(p1 == p2) ==> False
Note: Above output is 'False' is because these two objects are stored in different locations in memory. By default Python compares objects based on where they are stored in memory. To check the memory address of an object we can use 'id()' method
print(id(p1)) ==> 4518487376
print(id(p2)) ==> 4518487982
To fix this issue we need to implement magic method called '__eq__'
def __eq__(self, other):
return self.x == other.x && self.y == other.y
Note: In Python we have 'pass' statement which does nothing but satisfies Python to execution
******************************************** Popular Packages ******************************************
* requests
* twilio
* beautifulsoup4
****************************************** IMP points ******************************************
* We can use thriple quotes also in Python
"""
Hi Manoj,
How are you
"""
* We use # sign for comment
* 'block' is called as 'suite' in Python
* Strings in Python are Imutable, means they can't be changed
* In Python 'List' is nothing but 'Array', Lists are mutable
* List = [10, 'manoj', 20.4]
* Tuple = (12,25,77,96,48,35)
Tuple are immutable
* The difference B/W 'List' & 'Tuple' is 'mutable' & 'immutable' respectively. And we should use 'len()' to get the length of 'List' & we should use 'count()' to get the length of 'Tuple'
* set - {12, 45, 25, 78, 69}
-> set won't maintain sequesnce & doesn't support duplicate values & won't support indexing
* If we want index also, we need to use enumerate function
* We can't create 'Const' variable in Python
* 'null' is considered as 'none' in Python
* Decimal system
range 0-9
* Binary
range 0-1
* Octal system
range 0-7
* HexaDecimal system
range 0-9 Then a-f
* Backslash usage
print("Python Programmin")
print("Python \"Programmin")
print("Python \'Programmin")
print("Python \\Programmin")
print("Python \nProgrammin")
Backslash is called as escape character
* Formatted string
first = "Manoj"
last = "Kumar"
full = f"{first} {last}" ==> Manoj Kumar
****************************************** Python websites ******************************************
* www.python.org
* www.pypi.org
*