[Tutor] problem with simple script

Luke Paireepinart rabidpoobear at gmail.com
Wed Jul 28 14:14:38 CEST 2010

Just do a split of the input from the user on space or comma. If Len() of the split data is 1, do your [1, ...] interval, otherwise do the other interval.

Sent from my iPhone

On Jul 28, 2010, at 6:51 AM, "Richard D. Moores" <rdmoores at gmail.com> wrote:

> I have a practical need for a script that will give me a random int in the closed interval [n, m]. Please see <http://tutoree7.pastebin.com/xeCjE7bV>.
> This works fine when I enter both n and m as, for example, "23, 56", or even "56, 23". But often the closed interval is [1, m], so I'd like to not have to enter the 1 in those cases, and just enter, say, "37" to mean the interval [1, 37]. Highlighted lines 9-11 are my attempt to do this, but it fails. This seems like it should be so simple to do, but it isn't not for me. Advice, please.
> Thanks, 
> Dick Moores
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100728/b2bc23ce/attachment-0001.html>

More information about the Tutor mailing list