-
-
Notifications
You must be signed in to change notification settings - Fork 49.9k
Octal to Binary Convert #8949
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
Octal to Binary Convert #8949
Changes from 15 commits
c115900
8277f5b
6999155
7ad4dd0
2d73603
b03c5a3
7b0ac71
0f3e4bb
33f7f8e
8be37da
3040f99
fa33d5c
ee728ee
275e12d
9e75dd7
8906c9d
920fcc4
80d79eb
d5eacd9
eb4d80e
37e3391
25921bd
7e9f2af
761e1f7
2e91bcf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,55 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * Author: Bama Charan Chhandogi (https://github.com/BamaCharanChhandogi) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * Description: Convert a Octal number to Binary. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| reference for better understand | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| URL: https://en.wikipedia.org/wiki/Binary_number | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| URL: https://en.wikipedia.org/wiki/Octal | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| reference for better understand | |
| URL: https://en.wikipedia.org/wiki/Binary_number | |
| URL: https://en.wikipedia.org/wiki/Octal | |
| References for better understanding: | |
| https://en.wikipedia.org/wiki/Binary_number | |
| https://en.wikipedia.org/wiki/Octal |
BamaCharanChhandogi marked this conversation as resolved.
Show resolved
Hide resolved
tianyizheng02 marked this conversation as resolved.
Show resolved
Hide resolved
BamaCharanChhandogi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
BamaCharanChhandogi marked this conversation as resolved.
Show resolved
Hide resolved
BamaCharanChhandogi marked this conversation as resolved.
Show resolved
Hide resolved
tianyizheng02 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Outdated
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.
| binary_number = "" | |
| octal_digits = "01234567" | |
| """ | |
| ValueError: String to the function | |
| >>> oct_to_decimal("Av") | |
| Traceback (most recent call last): | |
| ... | |
| ValueError: Non-octal value was passed to the function | |
| >>> oct_to_decimal("90") | |
| Traceback (most recent call last): | |
| ... | |
| ValueError: Special Character was passed to the function | |
| >>> oct_to_decimal("#$") | |
| Traceback (most recent call last): | |
| ... | |
| ValueError: Empty String was passed to the function | |
| >>> oct_to_decimal("") | |
| ... | |
| ValueError: octal value was passed to the function | |
| >>> oct_to_decimal("17") | |
| 001111 | |
| >>> oct_to_decimal("7") | |
| 111 | |
| """ | |
| """ | |
| ValueError: String to the function | |
| >>> oct_to_decimal("Av") | |
| Traceback (most recent call last): | |
| ... | |
| ValueError: Non-octal value was passed to the function | |
| >>> oct_to_decimal("90") | |
| Traceback (most recent call last): | |
| ... | |
| ValueError: Special Character was passed to the function | |
| >>> oct_to_decimal("#$") | |
| Traceback (most recent call last): | |
| ... | |
| ValueError: Empty String was passed to the function | |
| >>> oct_to_decimal("") | |
| ... | |
| ValueError: octal value was passed to the function | |
| >>> oct_to_decimal("17") | |
| 001111 | |
| >>> oct_to_decimal("7") | |
| 111 | |
| """ | |
| binary_number = "" | |
| octal_digits = "01234567" |
Just noticed that the docstring is in the wrong place—I don't think these tests even pass because the error messages are wrong
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.
Please remove this empty line