Need Assistance?

support@tutorialshub.in

Control Flow

break, continue and pass

ADVERTISEMENT
Python Free Lesson
5 min read
ADVERTISEMENT

Strings are immutable text values

A Python string is an immutable sequence of Unicode characters. You can index and slice it, but operations that appear to modify a string actually return a new string.

Common text operations

Use strip() for surrounding whitespace, lower() or casefold() for appropriate normalization, split() to divide simple text, join() to combine pieces and replace() for straightforward substitutions.

Formatting and validation

F-strings are excellent for readable output. Methods such as startswith(), endswith() and in handle many checks without requiring regular expressions.

Practice: normalize a user's name by trimming whitespace, collapsing repeated spaces and displaying it consistently.

ADVERTISEMENT