We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ac37368 commit 05736fcCopy full SHA for 05736fc
decimal_to_binary.py
@@ -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