I'm currently trying to perform this, but my book for class doesn't show anything in relation to Boolean variables or anything related to this problem. I've been looking online for a while and everything is way too complicated for something that should be simple according the unit. If the solution is posted here, what was typed in to find it? Maybe I need to rephrase my question.
def getSecondWord(sentence): res = sentence.split(' ') if res.endswith('.'): return res[:-1] else: return res inputSentence = 'broccoli is delicious' secondWord = getSecondWord(inputSentence) print("second word is:", secondWord)