You are on page 1of 117

PYTHON PROGRAMMING DEEPAL SINGH BALI 190280103077

Sr. Title Page


No. From
1. PYTHON OBJECTS AND DATA 1
STRUCTURES
 Numbers 2
 Variable Assignment 6
 Strings 9
 Printing Format with Strings 15
 Lists 20
 Dictionaries 25
 Tuples 28
 Sets and Booleans 30
 Files 32
 Object and Data Structures Assessment Test 36
2. Python Comparison Operators 42
 Comparison Operators 43
 Chained Comparison Operators 45
3. Python Statements 47
 Introduction to Python Statements 48
 if, elif, else Statements 50
 for Loops 52
 while Loops 57
 Useful Operators 61
 List Comprehensions 65
 Statements Assessment Test 67
 Guessing Game Challenge 69
4. Methods and Functions 72
 Methods 73
 Functions 75
 Function Practice Exercises 79
 Lambda Expressions, Maps and Filters 87
 Nested Statements and Scope 90
 args and kwargs 94
 Function and Methods Homework 96
PYTHON
OBJECTS
AND DATA
STRUCTURES

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
PYTHON
COMPARISON
OPERATORS

42
50
51
52
53
54
PYTHON
STATEMENTS

47
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
METHODS
AND
FUNCTIONS

72
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

You might also like