[Tutor] how to take user input to form a list?

Alan Gauld alan.gauld at freenet.co.uk
Sun Nov 14 19:36:31 CET 2004


> I think, that Alan in his reply missed, that
> splitting will be done by "sequence-unpacking" in
> your code. But it will work only with exactly four
> characters entered, while the code he proposed will work
> for strings with arbitrary length (and produce lists
> of that length).

Exactly so, the sequence unpacking requires 
that 4 characters be entered *without* seperators.
Thus 1234 will be unpacked but 1,2,3,4 will not.

Similarly trying to enter numbers greater than 9 
will cause errors. Sequence unpacking from raw_input 
is usually the wrong way to go IMHO.

Alan G.



More information about the Tutor mailing list