b=‘The ADJECTIVE panda walked to the NOUN and then VERB. A nearby NOUN was unaffected by these events.‘
import re
keyword=[‘ADJECTIVE‘,‘NOUN‘,‘VERB‘,‘NOUN‘]
word=‘‘
s=‘‘
for n in range(len(keyword)):
word = keyword[n]
strinfo = re.compile(word)
s = input(‘Enter an ‘+word.lower()+‘:\n‘)
b = strinfo.sub(s,b,count=1)
print(b)
时间: 2024-08-06 07:56:49