我必须制作一个程序,该程序必须在具有用户指定关键字的句子中找到一个短语:
The Large Hadron Collider (LHC) is the world’s largest and most powerfulparticle accelerator.This site includes the latest news from the project, accessible explanations of how the LHC works, how it is funded, who works there and what benefits it brings us.You can access a wide range of resources for the public, journalists and teachers and students, there are also many links to other sources of information.The Large Hadron Collider atCERNnear Geneva, Switzerland is opening new vistas on the deepest secrets of the universe, stretching the imagination with newly discovered forms of matter, forces of nature, and dimensions of space.
用户指定:
['large', 'big', 'heavy']
我不确定如何在变量中的关键字之前和之后拿起几个词,例如:
keyword = 'large'
它必须返回
The Large Hadron
as large 出现在句子中。如何在句子中的任何变量之前放置一个单词和在任何变量之后放置一个单词?