mathimatikes prakseis

Giorgos Keramidas keramida at ceid.upatras.gr
Thu Nov 18 23:31:44 EET 2004


On 2004-11-18 08:37, Alaios <alaios at yahoo.com> wrote:
> kalispera tha ithela kati pou na mporeis na ektelesei
> mathimatikes prakseis se consola...
>
> Tha ithela na paizei apo konsola gia na min einai
> ypoxreomenos o xristis na anoigei kai na kleinei
> programmata.
>
> Tha thela gia paradeigma se ena synolo timon (i mia
> kato apo tin alli) na bro grigora mesi timi diaspora
> kai loipa kai na emfaniso kai mia grafiki paratasi ama
> laxei :)

May the Python be with you...

gothmog:/home/giorgos$ python
Python 2.3.4 (#2, Oct 23 2004, 20:30:13)
[GCC 3.4.2 [FreeBSD] 20040728] on freebsd6
Type "help", "copyright", "credits" or "license" for more information.
>>> from random import seed, randint, shuffle
>>> from os import getpid
>>> seed(getpid())
>>> a = range(0,32)
>>> shuffle(a)
>>> a
[25, 17, 5, 20, 15, 21, 1, 23, 4, 27, 28, 8, 13, 22, 26, 0, 29, 14, 24,
2, 11, 7, 3, 9, 10, 16, 6, 12, 31, 18, 19, 30]
>>> def koko(x):
...     return (x * random())
...
>>> from random import random
>>> b = map(koko, a)
>>> ma = sum(a)/len(a)
>>> mb = sum(b)/len(b)
>>> [ma, mb]
[15, 7.9696936363548012]
>>>




More information about the Linux-greek-users mailing list