Sep-30-2019, 10:59 PM
So I was given code to essentially begin the assignment, but for some reason I cannot for the life of me figure out where to go with it. I tried to do it on my own without the given code, but it went nowhere.
Essentially the idea is a user has to input words, and the code creates a list, simple, but in this assignment, I have to get the list to add 'and' with a space to the last word. This is where I am getting stuck, but the code I was given to begin makes me even more confused.
Essentially the idea is a user has to input words, and the code creates a list, simple, but in this assignment, I have to get the list to add 'and' with a space to the last word. This is where I am getting stuck, but the code I was given to begin makes me even more confused.
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)It literally is just putting a word in, and starting the input over again. It doesn't compile a list, it doesn't really do much of anything except repeat. I just don't understand where to start with this, should I just scrap it and start my own code for this?