[Tutor] What's the invalid syntax? Code supplied

Nathan Pinno falcon3166 at hotmail.com
Sun Aug 7 22:47:31 CEST 2005


Alan and all,

I'm no longer going to use this method. I thought up a more easier idea for 
dealing cards. I was going to share it, but with all this time and effort 
pointing out things that I should know, instead of helping me, I don't think 
I will, because it will probably be ripped to shreds by you, and dash my 
idea before it even takes off.

I will keep my ideas to myself,
Nathan Pinno
---------------------------------------------------------------
I wanted help, and you critised me,
I wanted aid, and you refused,
So I will do it myself!
--Author unknown
---------------------------------------------------------------
----- Original Message ----- 
From: "Alan G" <alan.gauld at freenet.co.uk>
To: "Nathan Pinno" <falcon3166 at hotmail.com>; "Tutor mailing list" 
<tutor at python.org>
Sent: Sunday, August 07, 2005 11:23 AM
Subject: Re: [Tutor] What's the invalid syntax? Code supplied


>> What's the invalid syntax? Here is the code:
>> import random
>> hand = {
>>    '0' : ["Ace"]
>>    '1' : ["Two"]
>
> Nathan,
>
> You really need to take some time out to read about data structures in 
> Python.
> You are trying to use a dictionary, with a string as a key and a list as a 
> value.
> The list has a single string as its content.
>
> As Kent has pointed out you almost certainly can use a number as the key 
> and
> I'm pretty sure you can get away with the string as the value. Why do you
> think you need a list as the value? Have you read any tutorial pages on
> dictionaries? Do you understand the concept of key/value pairs?
>
> You are making life difficult for yourself by picking inappropriate
> data structures. You are then posting broken code to the tutor list
> with no description of the error, or the error message text, which
> makes everyone on the list work much harder to figuure out what might
> be wrong! Ultimately it all slows down your work and everyone else
> who is contributing to the mailing list.
>
> Sorry if this sounds harsh but I've just come off 3 days of 14 hour
> shifts and am probably a bit less patient than normal. But this approach
> is slowing you down too. You will progress much faster if you take the
> time to *understand* what you are doing before doing it!
>
> Alan G
> Author of the Learn to Program web tutor
> http://www.freenetpages.co.uk/hp/alan.gauld
>
> 


More information about the Tutor mailing list