Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if __name__ == '__main__':
- N = int(input())
- list = []
- for n in range(N):
- x = input().split( )
- command = x[0]
- if command == 'insert':
- list.insert(int(x[1]), int(x[2]))
- if command == 'print':
- print(list)
- if command == 'remove':
- list.remove(int(x[1]))
- if command == 'append':
- list.append(int(x[1]))
- if command == 'sort':
- list = sorted(list)
- if command == 'pop':
- list.pop()
- if command == 'reverse':
- list = list[::-1]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement