Get startedGet started for free

Working with the string module

In the video, you saw several popular modules including string, which is used to gather specific values such as all uppercase characters, or format some text.

This can be helpful if you need to check whether text contains specific characters or modify text such as converting to lowercase.

In this exercise, you'll import the module and access its ascii_lowercase and punctuation attributes.

This exercise is part of the course

Intermediate Python for Developers

View Course

Exercise instructions

  • Import the string module.
  • Access the module's .ascii_lowercase attribute.
  • Access the module's .punctuation attribute.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Import the string module
____ ____

# Print all ASCII lowercase characters
print(____.____)

# Print all punctuation
print(____.____)
Edit and Run Code