Skip to content

Instantly share code, notes, and snippets.

View nickwohnhas's full-sized avatar
:octocat:
Remote

Nick Wohnhas nickwohnhas

:octocat:
Remote
  • Gordon-Darby Inc
  • Philadelphia, PA
View GitHub Profile
@nickwohnhas
nickwohnhas / variance.py
Created January 9, 2021 20:33
Calculating variance given a list numbers.
import functools
def variance(numbers):
mean = functools.reduce(lambda a,b : a+b, numbers) / len(numbers)
mapped_nums = map(lambda x : (x - mean)**2, numbers)
return functools.reduce(lambda a,b : a+b, mapped_nums) / len(numbers)
### Keybase proof
I hereby claim:
* I am nickwohnhas on github.
* I am nick_wohnhas (https://keybase.io/nick_wohnhas) on keybase.
* I have a public key ASBtHCGVOGlbsq6iFspnLFQq-8xkBy2W_MSL-cz1e40I7Qo
To claim this, I am signing this object:
@nickwohnhas
nickwohnhas / interview problem
Last active July 17, 2018 20:15
This groups the elements in an array that are palindromes into seperate arrays.
cities = ['Tokyo', 'London', 'Rome', 'Donlon', 'Kyoto', 'Paris', 'Kyoot']
empty_hash = {}
cities.each do |word|
empty_hash[word] = []
altered = cities.dup
altered.delete(word)
altered.each do |city|
if city.downcase.split("").sort == word.downcase.split("").sort