Get startedGet started for free

Put it in order!

Your company is analyzing the best way to provide users with different online courses. Your job is to scrape Wikipedia pages searching for tools used in Data Science subfields. You'll store the tool and field name in a database. After a text analysis, you realize that the information is provided in a specific position of the text but sometimes the field name is given first and the tool after that, while in other cases it's the other way around.

You decide to use positional formatting to handle these situations because it provides a way to reorder placeholders.

The text of one article has already been saved in the variable wikipedia_article. Also, the empty list my_list is already defined. You can use print() to view the variable in the IPython Shell.

This exercise is part of the course

Regular Expressions in Python

View Course

Hands-on interactive exercise

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

# Assign the substrings to the variables
first_pos = wikipedia_article[____].____
second_pos = wikipedia_article[____].____
Edit and Run Code