Skip to content

Commit 716a19c

Browse files
Merge pull request #8 from eskayML/Lsd
Added decimal_to_binary.py
2 parents 4e3d987 + 05736fc commit 716a19c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

decimal_to_binary.py

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
def dec_to_bin(n:int)->int:
2+
return int(str(bin(n))[2:])
3+
4+
#bin() is a function that takes in a string and converts it to binary provided the string is purely integer populated
5+
6+
7+
8+
num = int(input('Enter a number (base 10): '))
9+
print("It's value in binary is",dec_to_bin(num))

0 commit comments

Comments
 (0)