Python求助,全错但是又不知道错哪里

P5730 【深基5.例10】显示屏

sean_code @ 2022-06-20 12:58:29

n = int(input())
number = input().strip()
print(number)
k = 0
a = [['XXX'], ['..X'], ['X.X'],['X..']]
num = [[0,2,2,2,0], [1,1,1,1,1], [0,1,0,3,0], [0,1,0,1,0], [2,2,0,1,1], [0,3,0,1,0], [0,3,0,2,0], [0,1,1,1,1], [0,2,0,2,0], [0,2,0,1,0]]
for i in range(0, 5):
    for j in number:
        k += 1
        x = num[int(j)][i]
        if k == n:
            print(a[x][0])
            k = 0
        else:
            print(a[x][0], end='.')

by sean_code @ 2022-06-20 13:02:22

有一个print(number)忘记删了,删完以后还是错的。


by Joker_1212 @ 2022-06-20 13:34:54

@sean_code

input()
num = {'0': ('XXX', 'X.X', 'X.X', 'X.X', 'XXX'),
       '1': ('..X', '..X', '..X', '..X', '..X'),
       '2': ('XXX', '..X', 'XXX', 'X..', 'XXX'),
       '3': ('XXX', '..X', 'XXX', '..X', 'XXX'),
       '4': ('X.X', 'X.X', 'XXX', '..X', '..X'),
       '5': ('XXX', 'X..', 'XXX', '..X', 'XXX'),
       '6': ('XXX', 'X..', 'XXX', 'X.X', 'XXX'),
       '7': ('XXX', '..X', '..X', '..X', '..X'),
       '8': ('XXX', 'X.X', 'XXX', 'X.X', 'XXX'),
       '9': ('XXX', 'X.X', 'XXX', '..X', 'XXX'),
       '.': ('.', '.', '.', '.', '.')}
s = '.'.join(list(input().strip()))
for i in range(5):
    for j in s:
        print(num[j][i], end='')
    print()

by Joker_1212 @ 2022-06-20 13:37:35

@sean_code 为什么我提交就过了


by sean_code @ 2022-06-20 13:42:21

@Joker_1212 竟然如此我就用你的提交了,啊哈哈哈哈哈哈,你用我的提交是正确的?


by Joker_1212 @ 2022-06-20 13:45:20

@sean_code


by sean_code @ 2022-06-21 10:14:20

@Joker_1212 真好,我用你的提交就全对了,嘿嘿嘿


by Joker_1212 @ 2022-06-21 10:18:13

@sean_code 发的有点迟了吧?我都知道辽……


by runner_362 @ 2022-07-01 10:26:12

@sean_code 看我俩的用户名。。。


by sean_code @ 2022-07-03 12:44:06

@sean_coder 咦~你也叫Sean?


by runner_362 @ 2022-07-04 08:53:04

@sean_code 对啊,而且你是“sean_code”

我是“sean_coder”哈哈


| 下一页