I was suggested the below solution but I didn't understand this line cmd += "("+ ",".join(args) +")"
of the below code.
I got frustated because of this.Can someone please help me
Question is Reading an input like this
12
insert 0 5
insert 1 10
insert 0 6
print
remove 6
append 9
append 1
sort
print
pop
reverse
print
My arttempt in Python language
n = input()
l = []
for _ in range(n):
s = raw_input().split()
cmd = s[0]
args = s[1:]
if cmd !="print":
cmd += "("+ ",".join(args) +")"
eval("l."+cmd)
else:
print l