Skip to content

Instantly share code, notes, and snippets.

@wfwef
wfwef / gist:6789848
Created October 2, 2013 06:39
help!!
# Q3.
"1 2 3 4 5 6 [7] 6 5 4 3 2 1 [0] 1 2 [3] 2 1 0 [-1] 0 1 2 3 4 [5] [4] 5 6"
def pingpong(n):
"""Return the nth element of the ping-pong sequence.
>>> pingpong(7)
7