[Tutor] data question

Roelof Wobben rwobben at hotmail.com
Sat Oct 2 18:55:42 CEST 2010


Hello Alan, 
 
I think this is what can work : http://www.daniweb.com/code/snippet216750.html
 
I will try it.
 
 
Roelof

----------------------------------------
> From: rwobben at hotmail.com
> To: alan.gauld at btinternet.com; tutor at python.org
> Subject: RE: [Tutor] data question
> Date: Sat, 2 Oct 2010 13:40:21 +0000
>
>
> hello,
>
> Still one question.
>
> Every game is a dictonary/tuple ?
>
> Regards,
>
> Roelof
>
> ----------------------------------------
>> Date: Sat, 2 Oct 2010 06:24:16 -0700
>> From: alan.gauld at btinternet.com
>> Subject: Re: [Tutor] data question
>> To: rwobben at hotmail.com
>>
>> OK, So you want a list of games (possibly one per tournament
>> if you need to compare across tournies) where for each game
>> you store: homeTeam, awayTeam and scores.
>>
>> Each game could be represented as either a tuple or a dictionary
>> depending on how you want to extract the data:
>>
>> game['home'] or game[0]
>>
>> The list should probably be a list... :-)
>>
>> Try defining a short sample database in Python then try
>> extracting some values to get a feel for what suits you
>> best. Create the data in a module(easier to edit mistakes/changes)
>> Then use the>>> prompt to import the data module and play
>> around with it.
>>
>> That way it's easy to change from lists to tuples to dictionaries
>> and see what works.
>>
>> Ultimately this may even be best done using a database but
>> that's probably a step too far for you just now.
>>
>> Alan Gauld
>> Author of the Learn To Program website
>> http://www.alan-g.me.uk/
>>
>>
>>
>>
>> ----- Original Message ----
>>> From: Roelof Wobben
>>> To: alan.gauld at btinternet.com; tutor at python.org
>>> Sent: Saturday, 2 October, 2010 14:15:33
>>> Subject: RE: [Tutor] data question
>>>
>>>
>>>
>>>
>>> ----------------------------------------
>>>> To: tutor at python.org
>>>> From: alan.gauld at btinternet.com
>>>> Date: Sat, 2 Oct 2010 14:10:25 +0100
>>>> Subject: Re: [Tutor] data question
>>>>
>>>>
>>>> "Roelof Wobben" wrote
>>>>
>>>>> As a test I would write a programm where a user can input game-data
>>>>> like home-team, away-team, home-score, away-score) and makes a
>>>>> ranking of it.
>>>>
>>>>> In which datatype can I put this data in.
>>>>>
>>>>> I thought myself of a dictonary of tuples.
>>>>
>>>> A dictionary would be good for the basic data but I assume there
>>>> are more than one of these data items? If so what do they represent?
>>>> How would they be used?
>>>>
>>>> We need a bit more information, even some sample datya might help.
>>>>
>>>> It could be a list of dictionaries or even a dictionary of
>>>> dictionaries.
>>>>
>>>> Alan G.
>>>>
>>>>
>>>> _______________________________________________
>>>> Tutor maillist - Tutor at python.org
>>>> To unsubscribe or change subscription options:
>>>> http://mail.python.org/mailman/listinfo/tutor
>>>
>>> Hello Alan,
>>>
>>> What I meant was this:
>>>
>>> Let's say we have a tournament of 4 teams A,B,C,D
>>>
>>> They played this games.
>>>
>>> A - B 20 - 30
>>> C - D 23 - 67
>>>
>>> These data must be stored so I can make a module which make a ranking like
>>>this :
>>>
>>> 1) C 1 - 2 76 - 23
>>> 2) B 1 - 2 30 - 20
>>>
>>> I hope you know what I wan
>>>
>>>
>>> Roelof
>>> 		 	   		  


More information about the Tutor mailing list