Skip to content

Instantly share code, notes, and snippets.

@alexandre
Created October 30, 2014 06:54
Show Gist options
  • Select an option

  • Save alexandre/42866078f09a112ea92e to your computer and use it in GitHub Desktop.

Select an option

Save alexandre/42866078f09a112ea92e to your computer and use it in GitHub Desktop.
math and python
'''
Demonstrate how to use Python’s list comprehension syntax to produce
the list [0, 2, 6, 12, 20, 30, 42, 56, 72, 90].
cp = current position
list[cp + 1](2) - cp(0) == 2
list[cp +1](6) - cp(2) == 4
list[cp +1](12) - cp(6) == 6
list[cp +1](20) - cp(12) == 8
list[cp + 1](30)- cp(20) == 10
"Second-order arithmetic"
...
not solved yet...
'''
@aaron-goshine

Copy link
Copy Markdown

[(x + 1) * x for x in range(10)]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment