Python中的字母模式无法正确打印[关闭]

问题描述 投票:-1回答:1
需要在python中打印以下模式,任何人都可以更正我的代码或提供您的代码:

A BC DEF JIHG KLMNOP

我的代码:

My code snippet

任何人都可以帮忙吗?

python python-3.x algorithm alphabetical
1个回答
0
投票
这里是生成该模式的答案

next_line=0 condition_tracker = 0 alphabet = 65 for i in range(0, 26): print(chr(alphabet + i), end='') if condition_tracker == next_line: print() next_line = condition_tracker + 1 condition_tracker = 0 condition_tracker += 1

© www.soinside.com 2019 - 2024. All rights reserved.