轨道
/
Lua
Lua
/
练习
/
谚语
谚语

谚语

简单

说明

俗话说,只因少了一枚马蹄钉,一个王国便就此覆灭。

给定一组输入,生成相应的谚语。 例如,给定列表["nail", "shoe", "horse", "rider", "message", "battle", "kingdom"],你需要输出这首谚语诗谣的完整内容:

For want of a nail the shoe was lost.
For want of a shoe the horse was lost.
For want of a horse the rider was lost.
For want of a rider the message was lost.
For want of a message the battle was lost.
For want of a battle the kingdom was lost.
And all for the want of a nail.

注意,输入的列表可能各不相同;你的解答应能处理任意长度和任意内容的列表。 输出文本的每一行都不应是固定不变的字符串,而应随给定的输入而变化。


来源

Wikipedia链接会在新窗口或新标签页中打开
通过 GitHub 编辑 链接将在新窗口或新标签页中打开
Lua Exercism

准备好开始 谚语 了吗?

注册 Exercism,借助 117 个练习 和真人导师指导,学习并掌握 Lua,全部免费。