Question: **Problem:** 
Python provides a built-in function called **len** that returns the length of a string, so the value of len('allen') is 5.
Write a function named **right\_justify** that takes a string named **s** as a parameter and prints the string with enough leading spaces so that the last letter of the string is in column 70 of the display. 

```
>>> right_justify('allen')
                                                                allen

```

I tried writing some codes as follows: 

```
>>> def right_justify(s):
...     print                                                   s
...     
>>> right_justify('allen')
>>> allen  

```

The result is without enough leading spaces required by the exercise. And I couldn't use the built-in function **len** to help solve it either.

Any idea on how to resolve this problem?

Answer: 
Just adding *N - len(s)* spaces between `print` and `s` is not gonna help, as Python will simply ignore them. You can achieve this using string formatting:

```
>>> '{: >70}'.format('allen')
'                                                                 allen'

```

or `rjust` method of `str` objects:

```
>>> 'allen'.rjust(70)
'                                                                 allen'

```

or `format` function (which is the same as `str.format`, really):

```
>>> format('allen', ' >70')
'                                                                 allen'

```

Although the most straightforward way is

```
>>> s = 'allen'
>>> ' ' * (70 - len(s)) + s
'                                                                 allen'

```
Whitespace inserted after the `print` will be ignored unless it is inside quotation marks (`'` or `"`). You can use `*` to insert a particular character lots of times, e.g. to insert 30 spaces you can write `' ' * 30`. So use this to insert the desired number of spaces which you know will be determined by `len(s)` and the chosen screen width of 70 columns.