Professional Documents
Culture Documents
MODULE 2a
MODULE 2a
INTRODUCTION
TO PYTHON
PROGRAMMING
• For example,
#Hello
• For example,
type (1) gives you int
type (‘Hello’) gives you str
2. Types
• E.g. Int - 11 , 62
• Float – 21.236
• For example,
• str (1) gives ‘1’.
• str (4.5) gives ‘4.5’
M I C H A E L J A C K S O N
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
M I C H A E L J A C K S O N
- - - - - - -9 -8 -7 -6 -5 -4 -3 -2 -1
15 14 13 12 11 10
If we write B = A.upper ()
O/P is:
THRILLER IS THE SIXTH STUDIO ALBUM
If we write C = A.lower ()
O/P is:
thriller is the sixth studio album
• O/P is:
[2, 5, 6, 6, 8, 9, 9, 10, 10]
• L1 = L + [“pop”, 10]
• Output is
A = [10, 1.2]
• O/P is True
2. Union
• {“A”, “B”, “C”, “D”, “E”, “F”}
4. Difference
• gives you the element of A which
are not in B.
Key Values /
Elements
3. Dictionaries Key 1 Value 1
Key 2 Value 2
Key 3 Value 3
… …
• A.update ({“Graduation”:”abc”})
3. Dictionaries will add to dictionary.