Snippets Collections
# Infinity, and it's brother minus infinity, 
# comes in handy once in a while.


my_inf = float('Inf') 
99999999 > my_inf 
-> False 
 
my_neg_inf = float('-Inf') 
my_neg_inf > -99999999 
-> False 
def fibonacci(n):
    # return a list of fibonacci numbers
    numbers = [0, 1]
    for i in range(2,n):
        numbers.append(numbers[i-1] + numbers[i-2])
    return numbers[0:n]
const arrAvg = arr => arr.reduce((a,b) => a + b, 0) / arr.length
// arrAvg([20, 10, 5, 10]) -> 11.25
const arrSum = arr => arr.reduce((a,b) => a + b, 0)
// arrSum([20, 10, 5, 10]) -> 45
const arrMax = arr => Math.max(...arr);
// arrMax([20, 10, 5, 10]) -> 20
const arrMin = arr => Math.min(...arr);
// arrMin([20, 10, 5, 10]) -> 5

star

Mon Feb 28 2022 08:47:17 GMT+0000 (UTC) https://www.quora.com/What-are-some-cool-Python-tricks

#python #math #physics #stem
star

Thu Jan 06 2022 08:26:09 GMT+0000 (UTC) https://stackoverflow.com/questions/21857619/fibonacci-sequence-using-list-in-python

#python #math #python3
star

Mon Mar 23 2020 07:13:49 GMT+0000 (UTC) https://www.30secondsofcode.org/python/s/max-by/

#python #python #math #list
star

Sun Jan 05 2020 19:39:47 GMT+0000 (UTC) https://codeburst.io/javascript-arrays-finding-the-minimum-maximum-sum-average-values-f02f1b0ce332

#javascript #webdev #arrays #math
star

Sun Jan 05 2020 19:37:35 GMT+0000 (UTC) https://codeburst.io/javascript-arrays-finding-the-minimum-maximum-sum-average-values-f02f1b0ce332

#javascript #webdev #arrays #math
star

Sun Jan 05 2020 19:35:54 GMT+0000 (UTC) https://codeburst.io/javascript-arrays-finding-the-minimum-maximum-sum-average-values-f02f1b0ce332

#javascript #webdev #javascript #arrays #math
star

Sun Jan 05 2020 19:31:48 GMT+0000 (UTC) https://codeburst.io/javascript-arrays-finding-the-minimum-maximum-sum-average-values-f02f1b0ce332

#javascript #webdev #arrays #math

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension