HelpContactFor teachers and institutes
>_StemPy Lab
Mock TestsClasses

>_StemPy Lab

Learn. Solve. Code the solutions. Test yourself.

Live examsFree mock exams, timed and rankedEveryone starts together, and your score and rank come the moment it ends.See the exams →

Learn

  • Physics
  • Chemistry
  • Mathematics
  • Biology
  • Python Programming
  • Statistics & Data Science
  • Classes
  • Groups

Practice

  • Problems
  • Quizzes
  • Mock Tests
  • Prepare for an Exam
  • Question Sets
  • Exams
  • Certificates
  • Python Labs
  • AI Practice Generator
  • Student-Created Tests

Community

  • Discussions
  • Resources
  • Notes
  • Glossary
  • Blog

Account

  • Log in
© 2026 senLearn. All rights reserved.HelpAboutContactPrivacy PolicyTerms of UseRefund Policy
  1. Glossary
  2. /Python and data
  3. /String (in Python)

What is String (in Python)?

In short

A string is a piece of text in quotation marks, such as "hello". A string is a sequence of characters that you cannot change in place.

In simple words

Characters are numbered from 000, so "python"[0] is "p", and a negative number counts from the end: "python"[-1] is "n". Joining strings uses +, and repeating them uses *. Useful methods are upper, lower, strip, replace, find and split. An f-string, written f"mass = {m} kg", puts the value of a variable into the text.

Example

This prints NEWTON 6 n.

Learn it properly

  • Lessons on this topic
  • Test yourself

Related terms

  • Split and Join (Python strings)
  • Variable (in Python)

← All glossary terms

Learn it in

  1. Words and Text: Strings
All lessons on this topic →

Practise

  1. For the text "the cat sat on the mat", write the program lines that show: how many times…Medium
  2. A student wants to change the name "Rahul" to "Raju" and writes…Medium
  3. The variable word = "elephant" has eight letters…Easy
  4. The name is "asha rao". Show its initials in capital letters: AR.Hard

Quick questions

  1. A student tries five one-line programs that index or slice a string, a list or a…Advanced
  2. A program takes slices of a string, changes the case of letters, and searches for a…Hard
  3. A string contains a tab escape and a backslash escape. What does the program print?Hard

More Python and data terms

  1. Cell (in a Python notebook)
  2. Class and Special Methods (in Python)
  3. Dictionary (in Python)
  4. For Loop
  5. Function (in Python)
  6. If Statement (in Python)
All Python and data terms →

Try it yourself

Python labs run in your browser. Type the code, run it and see what happens.

Open a Python lab