I need to add the word 'and' to the end of my list, as in
a, b, and c
So far I've got the commas sorted out. I've seen how to get at the last item in a list here
Getting the last element of a list in Python
but do not want to overwrite or replace the last item, just add a word in front of it. This is what I have so far:
listToPrint = []
while True:
newWord = input('Enter a word to add to the list (press return to stop adding words) > ')
if newWord == '':
break
else:
listToPrint.append(newWord)
print('The list is: ' + ", ".join(listToPrint), end="")
As if its not too obvious, I'm fairly new to python, and this is being compiled in PyCharm.
Thanks in adv