我正在为 CS 类编写程序,需要一些 python 3 编码的帮助。这是我当前编写的代码:
def main():
print() # blank line
phrase = input("Please enter a phrase: ")
wordlist = phrase.split()
print("Original text:",phrase)
for msg in wordlist:
print(msg)
输出:
Phil
likes
to
code
我不能使用任何进口或类似的东西。我只能使用像循环或切片或拆分这样的小东西。任何帮助,将不胜感激。我需要输出看起来像:
P l t c
h i o o
i k d
l e e
s