Jul-11-2020, 08:04 AM
Trying to print the decimal number after each row, no success. Is it correct to use a variable (decimal) and then print it?
import random def outputConverted(binary): decimal = int(bin,2) print(decimal) for i in range(0,4): binary = "" for j in range(0,4): binary += str(random.randint(0, 1)) print ('Binary ' + binary + ' in decimal: ') outputConverted(binary)