PRIMITIVE OPERATIONS ON
STRINGS
1. CONCATENATION
2. CASE CONVERSION
3. INDEXING
4. SLICING
5. LENGTH
CONTENTS
Primitive operations on strings are basic operations that can
be performed directly on string data types. Here’s a summary:
1. Concatenation:
Combine two strings
using +
(e.g., "Hello" + "
World" "Hello
→
World").
2. Case Conversion:
Change case using
methods
like .lower(), .upper(),
.capitalize(), etc.
3. Indexing: Access a
character by its
position using square
brackets
(e.g., "Hello"[1] "e").
→
4. Slicing: Extract a
substring using
[start:end]
(e.g., "Hello"[1:4] →
"ell").
5. Length: Find the
number of
characters using
len()
(e.g., len("Hello") →
5).
CODE-OUTPUT
THANK
YOU
10129- G J
10130-V
10131-H
10132-R
10134-R

Presentation explaining the string concepts.pptx

  • 1.
    PRIMITIVE OPERATIONS ON STRINGS 1.CONCATENATION 2. CASE CONVERSION 3. INDEXING 4. SLICING 5. LENGTH CONTENTS
  • 2.
    Primitive operations onstrings are basic operations that can be performed directly on string data types. Here’s a summary: 1. Concatenation: Combine two strings using + (e.g., "Hello" + " World" "Hello → World"). 2. Case Conversion: Change case using methods like .lower(), .upper(), .capitalize(), etc. 3. Indexing: Access a character by its position using square brackets (e.g., "Hello"[1] "e"). → 4. Slicing: Extract a substring using [start:end] (e.g., "Hello"[1:4] → "ell"). 5. Length: Find the number of characters using len() (e.g., len("Hello") → 5).
  • 3.
  • 4.