On 30/03/2012 15:13, Barry Drake wrote:
On 30/03/12 15:04, Barry Drake wrote:
One of the things I wanted to do is to use a four integer array to get
four integers returned from a function. I ended up using what I think
is a list. (I'm not really sure of the datatypes yet). This is what I

Please read the tutorial if you haven't done so already at http://docs.python.org/tutorial/index.html

did, and it works, but looks very inelegant to me:

correct = 0
match = 0
wrong = 0
results = [correct, match, wrong]

Usually written

results = [0, 0, 0]

or even

results = [0] * 3


results = getflag(flag_1, results)
results = getflag(flag_2, results)
results = getflag(flag_3, results)
results = getflag(flag_4, results)

How is getflag defined and what are flag_1/2/3/4 ?


Sorry - I meant three-digit array, and the indents in the code fragment
above were all in line originally.


--
Cheers.

Mark Lawrence.

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to