这是一个我需要帮助的项目
A = ["having", "had", "is"]
B = ["will", "would", "should"]
sentence = input("Enter a sentence") #E.g. 'I will be having it in the future'
if A in sentence:
...
elif B in sentence:
...
在这里,我需要知道在句子中使用了数组A和数组B中的多少个单词
此处的输出应为:
有一个单词来自A&;句子中B的1个单词
你能帮帮我吗
Tags:
这应该行得通
如果要计算每个列表中的数字,则此操作应有效:
一种相当有效的方法是将
A
、B
和句子组合成集合,并找出它们的交点长度。例如:输出:
相关问题 更多 >
编程相关推荐