【问题标题】:Why am I getting presentation error in python list?为什么我在 python 列表中出现演示错误?
【发布时间】:2021-02-11 18:52:12
【问题描述】:

我的代码如下:

d = [int(d) for d in input().split()]

l = []
c = 1
for i in range(len(d)):
    if d[i] not in l:
        l.append(d[i])
        c += 1

for i in range(len(l)):
    print(l[i], end=" ")

评价:

输入:1 1 9 5 2 1 4 1 1 4 0 6 1 4 3 3 2 2 0 输出:1 9 5 2 4 0 6 3
状态:忽略演示错误后通过

【问题讨论】:

标签: python list split integer


【解决方案1】:

PresentationError 是一些制表符和空格之间的混合。 您可以删除脚本中的所有“标签”并一致地重写它们 或运行python -tt yourscript.py 以便您找到错误。

据我所知,您可以再次从问题中复制粘贴代码 因为它在复制后对我来说非常有用。

【讨论】:

    猜你喜欢
    • 2014-11-30
    • 1970-01-01
    • 1970-01-01
    • 2020-10-10
    • 2014-05-23
    • 1970-01-01
    • 2017-12-04
    • 2014-02-06
    • 2021-05-22
    相关资源
    最近更新 更多