[Tutor] problem with simple script

Richard D. Moores rdmoores at gmail.com
Wed Jul 28 17:35:56 CEST 2010

On Wed, Jul 28, 2010 at 04:51, 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.

While waiting for replies (they were there, but I had screwed up the
Gmail filter for them and they missed the inbox), I thought I'd just
avoid the need to split, and enter n and m separately. I also added
the ability to get another random int in the same closed interval,
without reentering n and m.

See this effort at <http://tutoree7.pastebin.com/QKvkGiXd>.

Now I'll dig into all the help I received. I see an *args in Steven's
detailed reply. That'll take some reviewing to understand.

Thanks VERY much!


More information about the Tutor mailing list