我的循环如何只给我第二个索引。并且没有得到第三个索引元素

2024-05-15 01:23:49 发布

您现在位置:Python中文网/ 问答频道 /正文

我的循环不能给我第三个索引元素。 我想澄清一件事,迭代之后,它没有给我最后一个索引

输入:

4

word

localization

internationalization

pneumonoultramicroscopicsilicovolcanoconiosis

输出:

word

l10n

i18n

p43s

我的代码:

n=int(input())
# print(n)
for i in range(1,n+3):
    count=0
    l=list(input())
    # print(l)
    if len(l)==0:
        pass
    elif len(l)>=10:
        start=l[0]
        end=l[-1]
        for x in l:
            print(x,end="")
    else:
        print("".join(l))

Tags: 代码in元素forinputlenl10ni18n

热门问题