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("========================
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
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images