[Tutor] repeat a sequence in range

Michael Lewis mjolewis at gmail.com
Sun Feb 12 00:22:54 CET 2012


I am trying to repeat a certain sequence in a range if a certain even
occurs. Forgive me for not pasting my code; but I am not at the machine
where it's saved.

Basically, I want to get user input and append that input to a list only if
the input is not already in the list. I want to do this x amount of times,
but if the user input is already in the list, then I want to repeat that
step in range(x).

At the prompt, I want to ask the user for:

Name 1:
Name 2:
Name 3:
etc....
 but if the user input for Name 3 was the same as the user input for Name
2, then I want to ask the user again for Name 3 instead of continuing to
Name 4.

How can I do this?

-- 
Michael J. Lewis

mjolewis at gmail.com
415.815.7257
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20120211/219c1f30/attachment-0001.html>


More information about the Tutor mailing list