Another stupid newbie question

Ian Leitch port001 at gentoo.org
Fri Feb 17 14:30:44 EST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Byte wrote:
> How can I make the following code:
> 
> from random import random
> 
> 
> 
> def stuff(a, mx):
>     x = 2
>     while x == 2:
>         x = random()
>         if x == mx: print x
>         else: print 'No luck,', x
>         x = 2
> 
> Stop when x == mx?
> 
> Thanks in advance,
>  -- /usr/bin/byte
> 

if x == mx:
    break
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFD9iRkefZ4eWAXRGIRAjbLAKCdl5RwFWz7uHSZd38HUjpA4HLGegCfWeP9
9Xw6bHYXhLssLKfG73AOKJo=
=WUrH
-----END PGP SIGNATURE-----



More information about the Python-list mailing list