Skip to content

Commit 9b25970

Browse files
authored
Added binary_to_decimal.py
1 parent 716a19c commit 9b25970

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

binary_to_decimal.py

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
def bin_to_dec(n:int)->int:
2+
return int(str(n),2)
3+
4+
5+
6+
num = int(input('Enter a number (base 2): '))
7+
print("It's value in base 10 is",bin_to_dec(num))

0 commit comments

Comments
 (0)