2.1.2
Strings
Test your knowledge with free interactive questions on Seneca — used by over 10 million students.
Strings
Strings are a special case of an array or list, where each element is a character. There are many methods we can apply to them:

Concatenation
- Concatenation is joining two strings together.
- This can be done with the + sign. E.g:
- "Hello " + "World" = "Hello World".

Accessing a character
- Remember, strings are just lists. So we can access a specific character in the exact same way as we access a list element:
- string[3] would get the fourth character.

Length of a string
- The length of a string is given by the len function:
- len("Hello") would give 5.

Substrings
- A substring is a part of a longer string.
- In Python we take a substring using:
- stringname[startPos:endPos]
- This takes a substring starting at the 'startPos'th character, and finishing at the 'endPos'th character.
1Introduction to Python
1.1Python
1.2Input & Output
1.3Data Types
1.4Variables & Constants
1.6Program Flow
2Data Structures
2.1Lists & Strings
2.2File Handling
3Modularity
3.1Subroutines
3.2Data Flow
4Good Practice
4.1Naming & Whitespace
4.2Comments
4.3Exceptions
Jump to other topics
1Introduction to Python
1.1Python
1.2Input & Output
1.3Data Types
1.4Variables & Constants
1.6Program Flow
2Data Structures
2.1Lists & Strings
2.2File Handling
3Modularity
3.1Subroutines
3.2Data Flow
4Good Practice
4.1Naming & Whitespace
4.2Comments
4.3Exceptions
Practice questions on Strings
Can you answer these? Test yourself with free interactive practice on Seneca — used by over 10 million students.
- 1What is concatenation?Multiple choice
Unlock your full potential with Seneca Premium
Unlimited access to 10,000+ open-ended exam questions
Mini-mock exams based on your study history
Unlock 800+ premium courses & e-books