Skip to content

Leaves - Nicky C.#30

Open
njch5 wants to merge 2 commits intoAda-C12:masterfrom
njch5:master
Open

Leaves - Nicky C.#30
njch5 wants to merge 2 commits intoAda-C12:masterfrom
njch5:master

Conversation

@njch5
Copy link

@njch5 njch5 commented Aug 29, 2019

Binary and Decimal

Congratulations! You're submitting your assignment.

Copy link

@CheezItMan CheezItMan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work, you hit the requirements here. Well done.

binary_array.each do |num|
sum_of_nums = binary_array[index] * (2 ** power_num)
power_num += 1
index -= 1

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clever going backwards through the array.

decimal_array << sum_of_nums
end

decimal_array.each do |num|

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: You could use .sum here or have been summing each sum_of_nums in the loop above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants