Last active
December 26, 2015 04:39
-
-
Save keitheis/7094579 to your computer and use it in GitHub Desktop.
仍是個有懈可擊的解。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def part_list(l, head_amount=1, tail_amount=1): | |
length = len(l) | |
tail_start = length - tail_amount | |
return l[head_amount-1], l[head_amount:tail_start], l[tail_start] | |
def main(): | |
l = range(5) | |
x, y, z = part_list(l, 1, 1) | |
print(x) # 0 | |
print(y) # [1, 2, 3] | |
print(z) # 4 | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment