I have a small problem with something I need to do in school...
My task is the get a raw input string from a user (text = raw_input()) and I need to pri
text = raw_input()
Simply pass your string into the following function:
def first_and_final(str): res = str.split(' ') fir = res[0] fin = res[len(res)-1] return([fir, fin])
Usage:
first_and_final('This is a sentence with a first and final word.')
Result:
['This', 'word.']