0

Because some keys in my dictionary are longer than others, the values do not align when printed. I want to get the values to match up with the furthest value, but I don't want extra spaces between the longest key and its value.

print("Name            Count")
print("=" * 15 + " " + "=" * 15)
for code in bird_dictionary.keys():
    print(code, bird_dictionary[code])

The name, count, and equal sign separator are correct and what I am going off of.

It is expected to look like this:

Name            Count
=============== ===============
Killdeer        2
Red-Tailed Hawk 1
Snowy Plover    1
Western Gull    2

How can I get the values to line up with count/the value of red-tailed hawk?

Scott Hunter
  • 48,888
  • 12
  • 60
  • 101
beginner
  • 21
  • 2

0 Answers0