So I have to write a program that reads a message from the user and prints a new message that contains all the words from the original message but in the same order without repeating any of them unless they show up more than once in the original message. <div>
<br></div><div>What I have thus far looks like this: </div><div><br></div><div><div>message = input(&quot;Your message:&quot;)</div><div>myList = message.split()</div><div>y = random.choice(myList)</div><div>z = len(myList)</div>
<div>while z !=0:</div><div>    myList.remove(y)</div><div>    print(y)</div><div><br></div><div>I can&#39;t figure out </div><div>1) How to remove &quot;y&quot; from the list and continue the loop; when I use .remove etc. it runs once then give me the error that &quot;y&quot; is not in the list. </div>
<div><br></div><div>I imagine the answer is quite simple I&#39;m just getting really frustrated trying to get this done any advice is appreciated.</div><div><br></div><div>Thanks </div><div>    </div><div>    </div></div>