Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

CodeSignal

Manipulating Strings in Python

via CodeSignal

Overview

Text shows up everywhere in real programs: names, messages, files, and user input. You will pinpoint characters by position, carve out substrings with slicing, clean and reshape text using built-in methods, and search, split, and join strings to pull out exactly the pieces you need.

Syllabus

Python String Indexing

  • Print Product Code Characters by Index
  • Reach the Last Character Two Ways
  • Find the Middle of the Code
  • Build a Short Code From Ends

Mastering String Slicing

  • Slice a Filename Prefix and Suffix
  • Extract the Invoice Number
  • Print the Final Three Characters
  • Print Every Second Character
  • Reverse the Filename with Slicing

Reshaping Strings with Methods

  • Show Case Changes Keep Original
  • Trim the Padded Input
  • Chain the Cleanup Methods
  • Strip Separators from a Phone Number

Searching and Splitting Strings

  • Check the Email for At
  • Locate the At and Split the Address
  • Check Both Edges of the Address
  • Split the Tag String
  • Rejoin the Tags with a Separator

Reviews

Start your review of Manipulating Strings in Python

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.