Skip to content

Commit

Permalink
Update: Refined docstring to include additional AssertionError cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Khusro-S committed Dec 29, 2024
1 parent a4ed391 commit 5e4d0fa
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions solutions/binary_to_decimal.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,16 @@ def binary_to_decimal(binary_str) -> int:
Converts a binary number represented as a string into its decimal equivalent.
Parameters:
binary_str: A string representing the binary number (e.g., '1010')
binary_str: A string representing the binary number (e.g., '1010')
Returns:
The decimal equivalent of the binary number as an integer
The decimal equivalent of the binary number as an integer
Raises:
AssertionError: If the input is a float.
AssertionError: If the input is None.
AssertionError: If the input is not a string.
AssertionError: If the input contains non-binary characters.
>>> binary_to_decimal ("1010")
10
Expand Down

0 comments on commit 5e4d0fa

Please sign in to comment.