[Tutor] Top Programming Languages of 2013

2007-10-06 Thread Dick Moores
Dick Moores ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] a code question, but don't know question's name

2007-10-06 Thread Happy Deer
Dear all- I am writing a function as follows. def getdata(varlist): eventually I have a variable called "data", which have exactly the same number of columns as the name of variables in varlist. Say varlist=['var1','var2','var3']. I want to assign var1=data[:,0], var2=data[:,1], var3=data[

Re: [Tutor] random number generator

2007-10-06 Thread Andrew James
I'm tempted to suggest using a hack to avoid floating point errors. Anyway, it isn't choosing a number to ten decimal places. It's actually out to 11 in both examples you gave. And it evaluates to correct because your guesses were to at least 10 places, which is as far as you account for in the

Re: [Tutor] ZeroDivisionError: float division

2007-10-06 Thread Alan Gauld
"pierre cutellic" <[EMAIL PROTECTED]> wrote > here is a a piece of code i can't debug: > > kx = (neighbor[1]+agent[1])/(dx-(neighbor[1]+agent[1])) > > in this line, 'neighbor[1]' and 'agent[1]' are both integers and > 'dx' is a > float so it gives me the following error: 'ZeroDivisionError: float

[Tutor] ZeroDivisionError: float division

2007-10-06 Thread pierre cutellic
Hi, i'm actually stuck with a stupid syntax problem. here is a a piece of code i can't debug: kx = (neighbor[1]+agent[1])/(dx-(neighbor[1]+agent[1])) in this line, 'neighbor[1]' and 'agent[1]' are both integers and 'dx' is a float so it gives me the following error: 'ZeroDivisionError: float div

Re: [Tutor] 网易邮箱自动回复: Re: How can I get ASCII of 'a' and '1'?

2007-10-06 Thread Kent Johnson
Eric Brunson wrote: > What is that, Perl? ;-) It is Chinese if you look at it right. Kent > [EMAIL PROTECTED] wrote: >> 您发给我的信件已经收到。 >> >> >> >> >> 网易163邮箱--中文邮箱第一品牌,2000兆超大空间,支持超大附件,全国唯一24小时客户服务。 >> 欢迎您来注册使用。网易邮件中心:http://mail.163.com > >

Re: [Tutor] ÍøÒ×ÓÊÏä×Ô¶¯»Ø ¸´: Re: How can I get ASCII of 'a' and '1 '?

2007-10-06 Thread Eric Brunson
What is that, Perl? ;-) [EMAIL PROTECTED] wrote: > Äú·¢¸øÎÒµÄÐżþÒѾ­ÊÕµ½¡£ > > > > > ÍøÒ×163ÓÊÏä--ÖÐÎÄÓÊÏäµÚÒ»Æ·ÅÆ£¬2000Õ׳¬´ó¿Õ¼ä£¬Ö§³Ö³¬´ó¸½¼þ£¬È«¹úΨһ24Сʱ¿Í»§·þÎñ¡£ > »¶Ó­ÄúÀ´×¢²áʹÓá£ÍøÒ×ÓʼþÖÐÐÄ£ºhttp://mail.163.com

Re: [Tutor] How can I get ASCII of 'a' and '1'?

2007-10-06 Thread Eric Brunson
Or, if you're on a real operating system (i.e. linix) you can type "man ascii". ;-) bhaaluu wrote: > Here's a handy reference file for ASCII. > (See attached file) > > > > ___

Re: [Tutor] How can I get ASCII of 'a' and '1'?

2007-10-06 Thread bhaaluu
Here's a handy reference file for ASCII. (See attached file) -- b h a a l u u at g m a i l dot c o m http://www.geocities.com/ek.bhaaluu/index.html On 10/6/07, Kent Johnson <[EMAIL PROTECTED]> wrote: > 林培恒 wrote: > > How can I get ASCII for alphabet and number, such as 'a' and '1'. I can > >

[Tutor] random number generator

2007-10-06 Thread Jim Hutchinson
Greetings all, It seems I forgot to subscribe to the list so I didn't receive any of the replies. However, I did check the archive and found all of the very helpful suggestions. Thanks for your time. Based on the replies I was able to get this to more or less work. However, one problem still exis

Re: [Tutor] Random module help

2007-10-06 Thread Alan Gauld
"Norman Khine" <[EMAIL PROTECTED]> wrote > q_keys.sort() > a = [q[x] for x in q_keys] a = [random.choice(q[x]) for x in q_keys] > > So from this how do I choose a random element and produce a new > dictionary like for example: See above. -- Alan Gauld Author of the Learn to Program web

Re: [Tutor] How can I get ASCII of 'a' and '1'?

2007-10-06 Thread Kent Johnson
林培恒 wrote: > How can I get ASCII for alphabet and number, such as 'a' and '1'. I can > get ASCII for character naturally in C but I don't how to in Python. You can get the character codes using ord(): In [1]: ord('a') Out[1]: 97 In [2]: ord('1') Out[2]: 49 The inverse function is chr(): In [

Re: [Tutor] Random module help

2007-10-06 Thread Norman Khine
Hi Alan, Thanks for the suggestion, but I am not sure it is what I am after. From your dictionary, for example, I wanted to have a list as: "what is your name?" "where do you live?" then the next time I run the program I will get: "who are you? "what is your address? etc... rather then, what

Re: [Tutor] Random module help

2007-10-06 Thread Alan Gauld
"Norman Khine" <[EMAIL PROTECTED]> wrote > But what I was wondering if possible in achieving is that my > questions > set (q) contains questions that are similar, i.e. they are written > in > different ways, so I wanted to get the random set of unique > questions > rather then have variations

[Tutor] How can I get ASCII of 'a' and '1'?

2007-10-06 Thread 林培恒
How can I get ASCII for alphabet and number, such as 'a' and '1'. I can get ASCII for character naturally in C but I don't how to in Python. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Random module help

2007-10-06 Thread Norman Khine
Alan Gauld wrote: > "Norman Khine" <[EMAIL PROTECTED]> wrote > > a = [q[x] for x in q_keys] > a >> ['1q', '4q', '5q', '7q', '8q'] > a >> ['1q', '4q', '5q', '7q', '8q'] >> >> >> This only returns the same questions, what am I doing wrong? How do >> I >> return a different set? > > I

Re: [Tutor] Random module help

2007-10-06 Thread Alan Gauld
"Norman Khine" <[EMAIL PROTECTED]> wrote > >>> a = [q[x] for x in q_keys] > >>> a > ['1q', '4q', '5q', '7q', '8q'] > >>> a > ['1q', '4q', '5q', '7q', '8q'] > > > This only returns the same questions, what am I doing wrong? How do > I > return a different set? I don't understand your problem. Yo

[Tutor] Random module help

2007-10-06 Thread Norman Khine
Hello, I have an 'Exam' module which selects new random set of questions and displays it, well this is the idea n;). Here is what I have so far: >>> import random >>> n_question = 5 >>> q = {1:'1q', 2:'2q', 3:'3q', 4:'4q', 5:'5q', 6:'6q', 7:'7q', 8:'8q', 9:'9q', 0:'0q'} >>> if len(q) > n_que