gpt4 book ai didi

Python如何输入4个单词的列表和 "fill in the blanks"造句

转载 作者:太空宇宙 更新时间:2023-11-04 07:57:04 26 4
gpt4 key购买 nike

到目前为止我有

def attack(words):
words = ['noun', 'verb', 'adjective', 'place']
print('Use your', words[2], words[0], 'and', words[1], 'towards the', words[3]+'!')

我要输入:

attack([shiny, broom, jump, sky])   

所以这句话应该是:用你 Shiny 的扫帚,向天空跳吧!

但它正在打印:用你的形容词名词和动词指向这个地方!

有什么想法我错过了什么吗?

最佳答案

也许是这样的,您可以根据需要的单词类型对输入列表进行索引?

def attack(words):
noun, verb, adjective, place = 0, 1, 2, 3
print('Use your', words[adjective], words[noun], 'and', words[verb], 'towards the', words[place]+'!')

关于Python如何输入4个单词的列表和 "fill in the blanks"造句,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46923633/

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