From 6902d04b9d1859e7c2328052abc448438241ee4b Mon Sep 17 00:00:00 2001 From: Chantal Demissie <42252976+ChantalDemissie@users.noreply.github.com> Date: Sun, 3 Mar 2019 16:46:48 -0800 Subject: [PATCH] Create chantal-sockets --- chantal-sockets | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 chantal-sockets diff --git a/chantal-sockets b/chantal-sockets new file mode 100644 index 0000000..9a66051 --- /dev/null +++ b/chantal-sockets @@ -0,0 +1,9 @@ +def binary_to_decimal(binary_array) + raise NotImplementedError + decimal = 0 + + binary_array.reverse.each_with_index do |num, i| + decimal += (num * 2 ** i) + end + return decimal +end