Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Change Binary into Decimal
# A = input(" Enter a Binary = ____") A = input() Y = 0 for y in A: if y != "1" and y!= "0": Y = 1 break print ("*"*20) S = 0 if Y == 0: n = len(A) for x in range(0, n): if A[x]== "0": N = 0 else: N = 2**(n-(x+1)) S = S + N print (" "*8, S) else: print ("Error(B)") print ("Not a Binary number") print ("*"*20)
run
|
edit
|
history
|
help
1
raja sainik
HW Descending order
0-1 Knapsack
Itc
innerclass.py
sept
Program of cube
mansur
Well, this seems bad.
PyBatScoreAbs