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
![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 --](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F04a1baba-7f8b-4cc8-88bc-614945bb1ac6%2F77d27f35-4fb4-4afb-9252-8764c7c292c0%2Fn9618yl_processed.png&w=3840&q=75)
![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](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F04a1baba-7f8b-4cc8-88bc-614945bb1ac6%2F77d27f35-4fb4-4afb-9252-8764c7c292c0%2F877q86f_processed.png&w=3840&q=75)

Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images









