Skip to content

Created octal_to_binary.py and fixed issue #8921 #8951

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

Closed
wants to merge 12 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update octal_to_binary.py
Added type hints for the octal_to_binary function
  • Loading branch information
navanitnandakumar authored Aug 12, 2023
commit e57c0f53913cfed64ff28a89b2bfb53ef3a0d2ab
4 changes: 1 addition & 3 deletions conversions/octal_to_binary.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
def octal_to_binary(octal):
def octal_to_binary(octal)->int:

Choose a reason for hiding this comment

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

As there is no test file in this pull request nor any test function or class in the file conversions/octal_to_binary.py, please provide doctest for the function octal_to_binary

Please provide type hint for the parameter: octal

# Converting Octal to Decimal
decimal = 0
power = 0
Expand All @@ -14,8 +14,6 @@ def octal_to_binary(octal):
decimal //= 2
digit_place *= 10
return binary


octal_number = int(input("Enter octal number: "))
binary_number = octal_to_binary(octal_number)
print(f"The binary equivalent of {octal_number} is {binary_number}")