gpt4 book ai didi

python - 在一行中打印字母 + 1

转载 作者:行者123 更新时间:2023-11-28 22:16:41 25 4
gpt4 key购买 nike

<分区>

Problem:

You and your friends have created a secret code!

The secret code is hidden in many lines. It's the first letter of the first line, plus the second letter of the second line, and so on, like this:

Basically it's a secret Won't they find it? Who would be looking? Nah! It's fine. B + o + o + ! spells BOO!

Your program should work like this:

Line: Basically it's a secret


Line: Won't they find it?

Line: Who would be looking?

Line: Nah! It's fine.

Line:

BOO! ​

Your program should read multiple lines of input, get the correct letter from each line. Then it should join each letter and print it in capitals.

到目前为止,我有这段代码可以获取输入,将每一行添加到一个列表中,然后当用户输入一个空格时它会停止。但是我有点不确定如何得到它所以打印第一行的第一个字母,打印第二行的第二个字母,打印第三行的第三个字母等等。

listo = []
line = input("Line: ")
while line:
listo.append(line)
line = input("Line: ")
print(test)
for i in listo:
print(i[0+1])

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com