Py Strings — Free Python Tutorial
Learn Py Strings in Python with a free, beginner-friendly tutorial, examples and practice for Indian students on Syllab.in.
TL;DR: Learn Py Strings in Python with a free, beginner-friendly tutorial, examples and practice for Indian students on Syllab.in.
Written & reviewed by the Syllab.in Academic Team (CBSE/NCERT subject experts) · Updated
Py Strings in Python
A string is a sequence of characters enclosed in single ('...') or double ("...") quotes. For multi-line strings, use triple quotes ("""..."""). Strings are immutable — you cannot change a character in place, but you can create new strings.
Python provides powerful built-in methods for string manipulation: converting case, searching, replacing, splitting, and trimming. These are used constantly in real-world programs.
f-strings (f"text {variable}") are the modern, preferred way to embed variables inside strings. They are faster and more readable than older concatenation (+) or format() methods.
Py Strings — Syntax
s = "Hello"
len(s) # length → 5
s.upper() # → "HELLO"
s.lower() # → "hello"
s[0] # first char → 'H'
s[1:4] # slice → "ell"
f"Hi {name}" # f-string
Learn Py Strings step by step with Syllab's free interactive Python tutorial — runnable code examples, practice exercises and instant AI feedback, all free with no signup. Explore the full Python course →