Index Ai Academy
Phase 0 · Tools · Python core

Strings and f-strings

Work with text: join it, slice it, clean it, and format it.

About 25 minutes · Free lesson

Start this lesson

Why it matters

A prompt is a string. A model's reply is a string. Most of the data you'll feed an AI system starts as messy text: subject lines with stray spaces, tags in inconsistent case, product names pasted from three different tools. Cleaning text and assembling it from pieces are skills you'll use in nearly every AI project, starting with building prompts from data.

What you'll be able to do

  • Pull out characters and slices of text with indexes
  • Clean and reshape text with string methods
  • Build text from variables with f-strings, including formatted numbers
  • Write multi-line text and special characters

Before this lesson

Next in this phase: Decisions with if/else