Challenge - Manipulate and format strings


Throughout these modules, code challenges reinforce what you've learned and help you gain some confidence before continuing on.

Step 1 - Add a new file in your working directory for this challenge

Use the techniques you learned in previous modules to add a new code file in the current folder dedicated to this module. For example, you might create a file named

Step 2 - Use string manipulation and formatting techniques you learned to create the challenge output

Copy the following code into your new file. Then modify it by adding new code to satisfy the requirements of the challenge.

first_value = '  FIRST challenge         '
second_value = '-  second challenge  -'
third_value = 'tH IR D-C HALLE NGE'

fourth_value = 'fourth'
fifth_value = 'fifth'
sixth_value = 'sixth'

# First challenge

# Second challenge

# Third challenge


# Fourth challenge - use only the print() function (no f-strings)

# Fifth challenge - use only a single print() function.  Create tabs and new lines using f-strings.

Using techniques you learned in this module, manipulate and format strings to produce the following output.

       First Challenge        
Second challenge
               Third challenge

There's likely more than one right way to accomplish this. But you do need to follow two rules:

Rule #1: You may only add code. You may not delete or modify the existing starter code, except to add new lines of code.

Rule #2: Your output must match the challenge output exactly.


Read the instructions in the code comments closely, and observe the desired output closely. For example, count spacing, and look for uppercase versus lowercase.

Whether you get stuck and need to peek at the solution, or you finish successfully, continue on to view a solution to this challenge.