We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 4e3d987 + 05736fc commit 716a19cCopy full SHA for 716a19c
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