Python for Data Analytics • Lesson 6
String Methods & Formatting
Learn how to clean, transform, search, split, join and format text using Python string methods and f-strings.
0 of 8 concepts completed
Complete the activity and related MCQ to unlock the next concept.
Change Case with upper() and lower()
upper() converts every letter to uppercase. lower() converts every letter to lowercase. Both leave numbers and punctuation untouched, and neither changes the original string — they return a new one.
Learn by Seeing
Standardize text case
"python".upper() # "PYTHON" "PYTHON".lower() # "python" name = "Vista Academy" print(name.upper()) # VISTA ACADEMY
upper() and lower() always return a new string; the original is unchanged.
Type text and toggle the method — see the live result:
>>> "Vista Academy".upper()
VISTA ACADEMY
Interactive Activity
What is the output of "python".upper()?
Hint: All letters become uppercase.
Python Analyst Mindset
Clean data, then analyze it
Real datasets arrive messy: extra spaces, mixed case, inconsistent separators. String methods are the first pass in any Python analysis — clean the text, then let the numbers behave.
Clean
strip, replace.
Standardize
upper, lower, title.
Reshape
split, join.
Report
f-strings.
Frequently Asked Questions
String Methods — FAQs
No. Strings are immutable. Every method returns a new string; the original is untouched.
split() breaks a string into a list. join() takes a list and glues it into one string with a separator.
It swaps all occurrences by default. Pass a third argument for a limited number of replacements.
Without the f, { } are literal characters. The f tells Python to evaluate them as expressions.
Lesson Summary
What you learned
Change the case of a string.
Remove whitespace; swap a substring.
Break a string into a list; glue a list into a string.
Locate a substring; count occurrences.
Chain methods left to right on the result of the previous call.
Insert variables into text with { } inside an f-prefixed string.