Strings - Practice Exercise

String Practice Widget
Python String Operations Cheat Sheet
  • str.capitalize() - Capitalize first letter
  • str.title() - Capitalize first letter of each word
  • str.upper() - All uppercase
  • str.lower() - All lowercase
  • str.strip() - Remove whitespace
  • str.lstrip(), str.rstrip() - Remove left/right whitespace
  • str.replace(old, new) - Replace substring
  • str.split(sep) - Split into list
  • str.join(list) - Join list into string
  • str.find(sub) - Find substring index
  • str.startswith(prefix), str.endswith(suffix)
  • str.isdigit(), str.isalpha(), str.isalnum()
  • str.format(...) - Format string
  • f"...{var}..." - f-string formatting
  • str[begin:end] - Slicing
Complete and Continue