Created
January 3, 2021 14:37
-
-
Save nythepegasus/ac217b9bf066ec938ff552e6c54f2364 to your computer and use it in GitHub Desktop.
Some fun oneliners I have made to do math problems easier
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
import math | |
### Find Population Standard Deviation ### | |
pop = [103,99,108,105,114,101] | |
math.sqrt(sum(list(map(lambda x: (x-sum(pop)/len(pop))**2, pop)))/len(pop)) | |
### Sigma Notation Using Range And Sum | |
# sum(range(first_num, last_num, step)) | |
sum(range(2, -449, -5)) | |
### Permutations/Combinations ### | |
r = 6 # How many per | |
n = 15 # Total | |
math.factorial(n)/math.factorial(n-r) # Permutations | |
math.factorial(n)/(math.factorial(r)*math.factorial(n-r)) # Combinations |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment