[Tutor] Lists and While Loops
rjbrow2 at gmail.com
Wed Mar 28 20:53:36 CEST 2012
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.
What I have thus far looks like this:
message = input("Your message:")
myList = message.split()
y = random.choice(myList)
z = len(myList)
while z !=0:
I can't figure out
1) How to remove "y" from the list and continue the loop; when I use
.remove etc. it runs once then give me the error that "y" is not in the
I imagine the answer is quite simple I'm just getting really frustrated
trying to get this done any advice is appreciated.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor