Hello I need help formatting this code:
This is my code:
def display_characters(character_list, display_type):
# Place your code here
print("===================================================")
print("- Character (heroes and villains) Summary -")
print("===================================================")
print("- P W L D Health -")
print("---------------------------------------------------")
# only hero chracters to be displayed
if display_type == 1:
for i in range(len(character_list)):
if character_list[i][2] == "h":
print("- ", end="")
print(character_list[i][0], end=" ")
print(character_list[i][3], end=" ")
print(character_list[i][4], end=" ")
print(character_list[i][5], end=" ")
print(character_list[i][6], end=" ")
print(" -")
print("---------------------------------------------------")
# only villain characters to be displayed
elif display_type == 2:
for i in range(len(character_list)):
if character_list[i][2] == "v":
print("- ", end="")
print(character_list[i][0], end=" ")
print(character_list[i][3], end=" ")
print(character_list[i][4], end=" ")
print(character_list[i][5], end=" ")
print(character_list[i][6], end=" ")
print(" -")
print("---------------------------------------------------")
# all characters to be displayed
else:
for i in range(len(character_list)):
print("- ", end="")
print(character_list[i][0], end=" ")
print(character_list[i][3], end=" ")
print(character_list[i][4], end=" ")
print(character_list[i][5], end=" ")
print(character_list[i][6], end=" ")
print(" -")
print("---------------------------------------------------")
print("===================================================")
And this is the output:
(THE IMAGE ATTACHED WITH BLACK BACKGROUND)
And I need it to look like this:
(THE IMAGE ATTACHED WITH WHITE BACKGROUND
Extracted text: Please enter choice [list, heroes, villains, search, reset, add, remove, high, battle, health, quit]: list Character (heroes and villains) Summary P W L D Ilealth Wonder Woman 5 5 0 0 90 Batman 2 0 80 The Joker 5 1 4 80 Superman 7 4 0 0 3 100 Catwoman 12 0 6 6 50 Aquaman 8 2 2 4 30 Iron Man 10 6 3 1 50 Hulk 2 1 4 80 Thanos 10 2 0 8 90 Please enter choice (list, heroes, villains, search, reset, add, remove, high, battle, health, quit): heroes Character (heroes and villains) Summary P W L D Health - Wonder Woman 5 5 0 0 90 - Batman 6 2 0 4 80 Superman 4 0 3 100 - Aquaman 2 2 4 30 Iron Man 10 6 3 1 50 Hulk 7 2 1 4 80 Please enter choice [list, heroes, villains, search, reset, add, remove, high, battle, health, quit]: villains Character (heroes and villains) Summary ===== P W L D Health The Joker 5 1 4 80 Catwoman 12 6 6 50 Thanos 10 2 0 8 90 Please enter choice (list, heroes, villains, search, reset, add, remove, high, battle, health, quit): quit -- Program terminating --
Extracted text: Please enter a choice [list, heroes, villains, search, reset, add, remove, high, battle, health, quit]: list In list command Character (heroes and villains) Summary PW L D Health Wonder Woman 5 5 0 0 Batman 6 2 0 4 The Joker 5 1 0 4 Superman 7 4 0 3 Catwoman 12 0 6 6 Aquaman 8 2 2 4 Iron Man 10 6 3 1 Hulk 7 2 1 4 Thanos 10 2 0 8