1 图 | 2 图 | 3 图 |
b = [0,0,0,0,
0,0,0,0,
0,0,0,0,
0,0,0,0 ] # 表示 4×4 方阵
time = input("输入时间(例:08:25 输入 0825):")
for i in range(len(time)):
n =
r2 = ""
for j in range(4): # 将数字转为 4 位二进制
r2 =
n //= 2
for j in range(len(r2)):
if r2[j] == "1":
b[j * 4 + i] = 1
s = ""
print(time, "模拟结果:")
for i in range(len(b)):
s += str(b[i]) + " "
if :
print(s)
s = ""