You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Consider a list (list = []). You can perform the following commands:
2
+
3
+
# insert i e: Insert integer at position .
4
+
# print: Print the list.
5
+
# remove e: Delete the first occurrence of integer .
6
+
# append e: Insert integer at the end of the list.
7
+
# sort: Sort the list.
8
+
# pop: Pop the last element from the list.
9
+
# reverse: Reverse the list.
10
+
# Initialize your list and read in the value of followed by lines of commands where each command will be of the types listed above. Iterate through each command in order and perform the corresponding operation on your list.
11
+
12
+
# Input Format
13
+
14
+
# The first line contains an integer, , denoting the number of commands.
15
+
# Each line of the subsequent lines contains one of the commands described above.
16
+
17
+
# Constraints
18
+
19
+
# The elements added to the list must be integers.
20
+
# Output Format
21
+
22
+
# For each command of type print, print the list on a new line.
0 commit comments