Skip to content

Instantly share code, notes, and snippets.

@tingplenting
Last active October 23, 2018 12:22
Show Gist options
  • Save tingplenting/cf92e739052a1cc4f7dca711f8573f7d to your computer and use it in GitHub Desktop.
Save tingplenting/cf92e739052a1cc4f7dca711f8573f7d to your computer and use it in GitHub Desktop.
import statistics as _s
# diketahui
A = list(range(1000000))
# 4a
def mean_odd_number(n):
odds = filter(lambda x: x % 2, n)
return _s.mean(odds)
print(mean_odd_number(A))
# 4b
print(_s.stdev(A))
# 4c
k = 10
if k in A:
print("k in A")
else:
print("not in A")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment