Python Strings

Introduction to Strings

A string is a sequence of characters enclosed within single quotes (') or double quotes ("). Strings are immutable, meaning once they are created, their contents cannot be modified. Strings in Python are powerful and come with many built-in methods for manipulation and formatting.

Example:

name = "Dodagatta Nihar"
greeting = 'Hello, Harsha!'

Both name and greeting are strings in this example. Python treats single-quoted and double-quoted strings the same way.