Module 3: Practice - Working with Text

Let's manipulate strings and understand how text is represented!

Anatomy of String Concatenation

Joining strings together is called concatenation, using the `+` symbol. Click the parts below to identify them. This relates to how we combine pieces of data (Data Representation).

"AI" + " " + "Rocks!"

Identify all 5 parts!

String Multiplication

You can "multiply" a string by an integer to repeat it. Try it below! This shows a simple form of Pattern Recognition - repeating a sequence.

Result appears here...

Finding String Length

The `len()` function tells you how many characters are in a string (including spaces!). This is fundamental to understanding the size of your text data. Enter a string below.

Length appears here...

Accessing Characters by Index

You can get a single character from a string using its index inside square brackets `[]`. Remember: Python indexing starts at 0! This is key to how sequence data is represented and accessed.

Character appears here...

String Mini Missions!

Combine your new string skills! Complete these coding tasks using the `print()` function in the editors below.

Mission 1: Combine Words

Write a command to `print` the result of joining the string `"Applied "` with the string `"AI"`. Don't forget the space if needed!

Output...

Mission 2: Repeat and Measure

Write two separate `print()` commands. The first should print the string `"Go! "` repeated 3 times. The second should print the length of the string `"Data"`.

Output...

Mission 3: First and Last

Given the string `"Module"`, write a command to `print` its first character (index 0). On the next line, write another command to `print` its last character (index 5).

Output...

Module 3 Practice Complete!

Excellent work manipulating strings! You're getting the hang of text data in Python.
Ready for more? Try the Advanced Practice for Module 3!