一、提出任务
给你一个英语句子,比如"London bridge is falling down",把它完全倒装过来,"down falling is bridge London"。
二、编写源代码

"""
给你一个英语句子,比如"London bridge is falling down",
把它完全倒装过来,成为"down falling is bridge London"。
"""
sentence = "London bridge is falling down"
print("原始语句:" + sentence)
print("\n方法一:句子拆分-单词数组-数组倒序")
words = sentence.split(" ")
count = len(words)
for i in range(count):
print(words[i], end=" ")
print()
for i in range(count):
print(words[count - i - 1], end=" ")
prin
本文通过Python编程实现将英文句子倒置的功能,详细介绍了任务提出、源代码编写及程序运行展示。
订阅专栏 解锁全文
637

被折叠的 条评论
为什么被折叠?



