-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path14. Heroes.py
44 lines (30 loc) · 1.05 KB
/
14. Heroes.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
'''
A module that helps us keep track of our favourite heroes from marvel
'''
from typing import List
def marvel_hero(heroes: List[str])-> None:
"""
A function that helps us keep track of our favourite marvel heroes.
:param heroes: a list that contains the name of our cherished marvel heroes
:return: None
"""
# Total number of heroes stored in our list
print(f"Total number of heroes store in our list is {len(heroes)}")
# Adding Black Panther to the end of the list
heroes.append("Black Panther")
# Removing Black Panther from the list
heroes.pop()
# Adding wolverine to the list of heroes
heroes.append("wolverine")
# Adding black panther at index 3
heroes.insert(3,"black panther")
# Removing Thor
heroes.remove("thor")
# Replacing hulk with dr strange
heroes[1]= "dr Strange"
# Sorting list heroes
heroes.sort()
# Print updated list of favourite heroes
print(heroes)
heroes_marvel=['spider man','thor','hulk','iron man','captain america']
marvel_hero(heroes_marvel)