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("========================

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

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 --
Transcribed Image 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 --
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
Transcribed Image 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
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY