-
Notifications
You must be signed in to change notification settings - Fork 54
Leah - Water #49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Leah - Water #49
Conversation
There was a problem hiding this 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 learning goals here. Well done.
|
|
||
| # Generates random array to pass as argument in binary_to_decimal method | ||
| binary_numbers = Array.new(8) {rand (0..1)} | ||
|
|
||
| binary_to_decimal(binary_numbers) | ||
|
|
||
|
|
||
| # Test Arrays | ||
|
|
||
| array = [1, 1, 1] #7 | ||
|
|
||
| arr2 = [1, 0, 0, 1] #9 | ||
|
|
||
| arr3 = [1, 0, 1, 1] #11 | ||
|
|
||
| arr4 = [0, 1, 1, 1] #7 | ||
|
|
||
|
|
||
| # puts binary_to_decimal(array) | ||
|
|
||
| # puts binary_to_decimal(arr2) | ||
|
|
||
| # puts binary_to_decimal(arr3) + binary_to_decimal(arr4) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| # Generates random array to pass as argument in binary_to_decimal method | |
| binary_numbers = Array.new(8) {rand (0..1)} | |
| binary_to_decimal(binary_numbers) | |
| # Test Arrays | |
| array = [1, 1, 1] #7 | |
| arr2 = [1, 0, 0, 1] #9 | |
| arr3 = [1, 0, 1, 1] #11 | |
| arr4 = [0, 1, 1, 1] #7 | |
| # puts binary_to_decimal(array) | |
| # puts binary_to_decimal(arr2) | |
| # puts binary_to_decimal(arr3) + binary_to_decimal(arr4) |
| # Calculate and return the decimal value for this binary number using the algorithm you devised in class. | ||
|
|
||
| def binary_to_decimal(binary_array) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Well done
Binary and Decimal
Congratulations! You're submitting your assignment.