We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Python
- Basic Data Types
- Lists
- Discussions
Lists
Lists
Sort by
recency
|
2912 Discussions
|
Please Login in order to post a comment
if name == 'main': N = int(input())
new_list = []
for i in range (N): command = input().split() if command[0] == "append": new_list.append(int(command[1])) elif command[0] == "insert": new_list.insert(int(command[1]), int(command[2])) elif command[0] == "remove": new_list.remove(int(command[1])) elif command[0] == "sort": new_list.sort() elif command[0] == "pop": new_list.pop() elif command[0] == "reverse": new_list.reverse() elif command[0] == "print": print(new_list)
if name == 'main':
if name == 'main': N = int(input()) my_list = []