mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-02-26 02:48:40 +00:00
Updated octal_to_binary.py
Fixed whitespaces in blank lines.
This commit is contained in:
parent
56efdb87a0
commit
79eb033726
@ -6,7 +6,6 @@ def octal_to_binary(octal):
|
|||||||
decimal += (octal % 10) * pow(8, power)
|
decimal += (octal % 10) * pow(8, power)
|
||||||
octal //= 10
|
octal //= 10
|
||||||
power += 1
|
power += 1
|
||||||
|
|
||||||
# Converting Decimal to Binary
|
# Converting Decimal to Binary
|
||||||
binary = 0
|
binary = 0
|
||||||
digit_place = 1
|
digit_place = 1
|
||||||
@ -14,10 +13,7 @@ def octal_to_binary(octal):
|
|||||||
binary += (decimal % 2) * digit_place
|
binary += (decimal % 2) * digit_place
|
||||||
decimal //= 2
|
decimal //= 2
|
||||||
digit_place *= 10
|
digit_place *= 10
|
||||||
|
|
||||||
return binary
|
return binary
|
||||||
|
|
||||||
|
|
||||||
octal_number = int(input("Enter octal number: "))
|
octal_number = int(input("Enter octal number: "))
|
||||||
binary_number = octal_to_binary(octal_number)
|
binary_number = octal_to_binary(octal_number)
|
||||||
print(f"The binary equivalent of {octal_number} is {binary_number}")
|
print(f"The binary equivalent of {octal_number} is {binary_number}")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user