From 1f2312f548c03861ac6af8c4e84403d97e3a9f01 Mon Sep 17 00:00:00 2001 From: pm bhatiya <61078575+pmbhatiya@users.noreply.github.com> Date: Sat, 14 Mar 2020 18:24:34 +0530 Subject: [PATCH] Add files via upload --- Lists.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Lists.py diff --git a/Lists.py b/Lists.py new file mode 100644 index 0000000..a775de1 --- /dev/null +++ b/Lists.py @@ -0,0 +1,19 @@ +#Lists problem of Python Hackerarank +array = [] +for _ in range(int(input())): + command = input().strip().split(" ") + cmd_type = command[0] + if (cmd_type == "print"): + print(array) + elif (cmd_type == "sort"): + array.sort() + elif (cmd_type == "reverse"): + array.reverse() + elif (cmd_type == "pop"): + array.pop() + elif (cmd_type == "remove"): + array.remove(int(command[1])) + elif (cmd_type == "append"): + array.append(int(command[1])) + elif (cmd_type == "insert"): + array.insert(int(command[1]), int(command[2])) \ No newline at end of file