Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def lista_operacoes(lista, *args):
- if args[0] == 'insert':
- lista.insert(int(args[1]), int(args[2]))
- elif args[0] == 'print':
- print(lista)
- elif args[0] == 'remove':
- lista.remove(int(args[1]))
- elif args[0] == 'append':
- lista.append(int(args[1]))
- elif args[0] == 'sort':
- lista = lista.sort()
- elif args[0] == 'pop':
- lista.pop()
- elif args[0] == 'reverse':
- lista = lista.reverse()
- if __name__ == '__main__':
- N = int(input())
- lista = []
- for _, _ in enumerate(range(N)):
- entradas = input().split()
- lista_operacoes(lista, *entradas)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement