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
word repeat
HW selectionsort using while
Юра и заселение
PyNewInit
3564
sai hw user enter table
Tuples operating with '+' '*'
repeat string
P
Gift_Card Interview SQL Analysis Conducted by Miranda Zhao