Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
countries = ['Germany', 'Slovakia', 'Italy']
def getCountry(sentence):
'''Finds a word from a sentence that matches a word in the list. '''
listOfWords = sentence.split() #Creates a list of words from sentence
for word in listOfWords:
for country in countries:
if word == country:
keyWord = word
return keyWord
sen = input('give me a sentence')
if getCountry(sen) is None:
print('no country')
else:
print(getCountry(sen))