Apr-09-2020, 01:46 PM
What exactly is going on with the
{counter:>02}
parameter in the fmt_directory_entry
assignment? In particular, how is it effected that 0 should be inserted to the left of counter
if len(counter) > 2
? Is there a way I could make it be an other symbol other than 0, say the letter i? def print_results(): fmt_directory_entry = "{counter:>02}. {director:<52} {avg}" for counter, director_info in enumerate(top_directors_with_at_least_four(), 1): director, rating = director_info[0] print(fmt_directory_entry.format(counter=counter, director=director, avg=rating))
Output:01. Sergio Leone 8.5
02. Christopher Nolan 8.4
03. Quentin Tarantino 8.2
...
10. Alfonso Cuarón 7.8
11. Peter Jackson 7.7
12. Martin Scorsese 7.7