avatar Bite 162. Vertically align output of counters

In this Bite you are tasked with "physically" aligning the number of comments on a webpage.

For some reason you are not allowed to use the pre tag so you are asked to prepend each number with one or more HTML spaces ( ).

You need to make sure the comment counts line up vertically, so in order for the web page to show this:

   1
  20
 315
1239

You need to produce this output:

   1
  20
 315
1239

Complete prefill_with_character(value, column_length=4, fill_char=' ') to achieve this.

Your code is expected to also work if other values are provided for the column_length and fill_char arguments. Have fun!

Login and get coding
go back Intermediate level
Bitecoin 3X

Will you be Pythonista #130 to crack this Bite?
Resolution time: ~19 min. (avg. submissions of 5-240 min.)
Pythonistas rate this Bite 1.89 on a 1-10 difficulty scale.
» You can do it! 😌

Focus on this Bite hiding sidebars, turn on Focus Mode.

Ask for Help