Read a dictionary fallback
Follow the lookup and each string method in order.
def display_name(profile):
return profile.get("name", "Guest").strip().title()
The fallback is used only when name is absent. Otherwise the stored value is stripped and converted to title case.
What does display_name return for {"name": " ada "}?
Why it matters: Small chained operations can combine fallback behavior with several value transformations.