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 1c86990 commit acc4db3Copy full SHA for acc4db3
Binary To Decimal #2746
@@ -0,0 +1,8 @@
1
+def binary_to_decimal(binary):
2
+ decimal = 0
3
+ for digit in binary:
4
+ decimal = decimal * 2 + int(digit)
5
+ return decimal
6
+
7
+binary = input("Enter binary number: ")
8
+print("Decimal number:", binary_to_decimal(binary))
0 commit comments