If I have a = [1, 2, 3]
, how can I get [2, 3, 1]
without an intermediate
variable (or numpy.roll
)?
For context, I’d like to do something like this:
for x, y in zip(a, a[1:].append(a[0])):
# Do things
If I have a = [1, 2, 3]
, how can I get [2, 3, 1]
without an intermediate
variable (or numpy.roll
)?
For context, I’d like to do something like this:
for x, y in zip(a, a[1:].append(a[0])):
# Do things