Exponential arrival distribution in Python
Hi all, I am doing a project on traffic simulation. I want to introduce exponential arrival distribution to precede this task. Therefore I want write a code in python for exponential arrival distribution. I am very new for programming and if anybody can help me on this that would be great. Cheers, Ricky -- http://mail.python.org/mailman/listinfo/python-list
Re: List question
On 2008-03-21 05:16:41 PM, [EMAIL PROTECTED] wrote:
> alist = []
> blist = [ 'one','two','one and two','one and four','five','one two']
> for f in blist:
> if 'one' and 'two' in f:
> alist.append(f)
>
> for i in alist:
> print i
>
> two
> one and two
> one two
>
>
> why is it printing the first "two"?
Look at the this line:
if 'one' and 'two' in f:
You're basically saying:
if ('one') and ('two' in f):
which is why you only get elements that contain 'two'.
Ricky
pgpLDeQ6Gg7ma.pgp
Description: PGP signature
--
http://mail.python.org/mailman/listinfo/python-list
Re: Newbie: How to pass a dictionary to a function?
On 2008-04-07 08:54:09 PM, BonusOnus wrote:
> How do I pass a dictionary to a function as an argument?
>
>
> # Say I have a function foo...
> def foo (arg=[]):
Try:
def foo(arg={}):
Thanks,
Ricky
pgpXEZLwP4mLj.pgp
Description: PGP signature
--
http://mail.python.org/mailman/listinfo/python-list
