+ 1

Please is there anything wrong with this code

convert decimal to binary def convertDecToBinary(n): bin_list = [] while n > 0: m = n%2 bin_list.append(m) result = "" for e in bin_list[::-1]: result += str(e) return result print (convertDecToBinary(7))

23rd Nov 2018, 6:13 AM
naira leak
naira leak - avatar
2 Answers
0
please can you rewrite with your correction ?
23rd Nov 2018, 7:48 AM
naira leak
naira leak - avatar
0
you are right. Thanks
23rd Nov 2018, 7:53 AM
naira leak
naira leak - avatar