-3

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.

https://i.stack.imgur.com/RMSEx.png

  • Yes, this question needs a lot of work. Start with [ask]. We have no idea what book you are talking about, or what your assignment is, what you've been learning or any of that. Also, I don't know why you refer to boolean variables, there is nothing in your image or your text that implies that. – juanpa.arrivillaga Sep 29 '17 at 18:27

1 Answers1

0
def getSecondWord(sentence):
    res = sentence.split(' ')[1]
    if res.endswith('.'):
        return res[:-1]
    else:
        return res

inputSentence = 'broccoli is delicious'
secondWord = getSecondWord(inputSentence)

print("second word is:", secondWord)
tkhurana96
  • 919
  • 7
  • 25