Skip to content

Commit f8add6e

Browse files
2_arrays_marvel.py
1 parent 8c22aa0 commit f8add6e

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
heros=['spider man','thor','hulk','iron man','captain america']
2+
3+
print("Length of the list: ",len(heros))
4+
5+
heros.append('black panther')
6+
print("Add 'black panther' at the end of this list: ",heros)
7+
8+
heros.remove('black panther')
9+
heros.insert(3,'black panther')
10+
print("You realize that you need to add 'black panther' after 'hulk',so remove it from the list first and then add it after 'hulk':", heros )
11+
12+
heros[1:3]=['doctor strange']
13+
print("Now you don't like thor and hulk because they get angry easily. So you want to remove thor and hulk from list and replace them with doctor strange (because he is cool). Do that with one line of code.", heros)
14+
15+
heros.sort()
16+
print('Sort the heros list in alphabetical order (Hint. Use dir() functions to list down all functions available in list):', heros)

0 commit comments

Comments
 (0)