You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if __name__ == '__main__':
N = int(raw_input())
res = []
for i in range(0, N):
line = raw_input()
ops = line.split(' ')
if ops[0] == "print":
print res
else:
func = getattr(list, ops[0])
oprands = ops[1:]
if len(oprands) == 0:
func(res)
else:
oprands = [int(num) for num in oprands]
func(res, *oprands)
string.split() vs string.split(' ') When there are multiple spaces, the latter result can contain empty strings.