We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Commands like "pop" and "popleft" that after split() have just one element. So there haven't enough values to assign to the variable value. It will cause ValueError.
command , value, *arg = input().split() + ['']
the variable with * can assigned zero or more values.
If command is "pop", the [''] in the last assigned to value.
If command is "append 1", the "1" assigned to value and the [''] in the last assigned to arg.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Collections.deque()
You are viewing a single comment's thread. Return to all comments →
Commands like "pop" and "popleft" that after split() have just one element. So there haven't enough values to assign to the variable
value
. It will cause ValueError.the variable with * can assigned zero or more values.
['']
in the last assigned tovalue
."1"
assigned tovalue
and the['']
in the last assigned toarg
.