Class 3 of Module 2 - Strings in Python Syllabus, VIT

VijayanthVijay 30 views 24 slides Oct 31, 2025
Slide 1
Slide 1 of 24
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24

About This Presentation

Class 3 of Module 2 - Strings in Python Syllabus, VIT


Slide Content

PYTHON Module 2

Split method Extracts the individual words separated by spaces, tabs(\t) and new lines(\n)

Cleaning Up Strings Using for and in command it is possible to search for certain unwanted characters in strings and remove them Then a new string can be created using the concatenation operator .

Example Cleaned string with no punctuations.

Formatting strings using placeholders Place holder is a facility in Python to create an empty space to store a value there later. Using this feature, Python allows us to insert any value/string during the run time of the program.

Example

Formatting strings using placeholders

Output(s)

Other examples

Output(s)

Other examples Many other examples found in the book… TRY THEM.

TUPLE It is a complex variable consisting of more than one value. They are entered inside braces and separated by commas as follows.

Examples

TUPLE It is possible to access a particular location within any Tuple. … using Indexing as follows: Tuple Name[index #]

Example

TUPLE Just like strings, Tuples are immutable too. Once Python creates a tuple within its memory, it does not vary its contents later on.

Example

TUPLE While working on real time data, it is sometimes necessary to initially create a tuple with a single value within it. Such tuples are created as follows: Tuple_name = (value,)

Example

Example Note: Without the comma, the type would be string and not tuple.

TUPLE Assignment Python supports Tuple packing & Tuple unpacking Tuple packing is done as follows: Tuple_name = (value1, “value 2” , value 3,)

TUPLE Packing

TUPLE Unpacking Tuple unpacking is the process of storing the variables within a Tuple separately as follows: (V1, V2, V3) = Tuple_name

TUPLE Unpacking
Tags