[Tutor] problem with simple script

Nick Raptis airscorp at otenet.gr
Wed Jul 28 14:16:05 CEST 2010


On 07/28/2010 02:51 PM, Richard D. Moores 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
>    
Split the input before the if.
Fork based on the length of the resulting list.
:)

Nick


More information about the Tutor mailing list