Skip to content

Commit

Permalink
formatting + comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Muna-S committed Jan 12, 2025
1 parent d0b8090 commit 4142b17
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion solutions/binary_decimal_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,11 @@ def binary_to_decimal(binary: str) -> int:
This function takes a binary number from command line as paramter,
and returns its decimal representation.
Example: BinaryToDecimal('decimal', 10011101)
Example: binary_to_decimal('decimal', 10011101)
>>> 157
Example: binary_to_decimal('decimal', 'hello')
>>> ValueError: Input must only contain 0s and 1s
"""
if not all(c in "01" for c in binary):
raise ValueError("Input must only contain 0s and 1s")
Expand Down
2 changes: 1 addition & 1 deletion solutions/tests/test_binary_decimal_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"""

import unittest
from binary_decimal_conversion import (
from solutions.binary_decimal_conversion import (
decimal_to_binary,
binary_decimal_conversion,
binary_to_decimal,
Expand Down

0 comments on commit 4142b17

Please sign in to comment.