[Tutor] Python help

Alan Gauld alan.gauld at btinternet.com
Mon Nov 3 23:37:53 CET 2014


On 03/11/14 20:26, Juwel Williams wrote:

> I am confused about tuples, lists and dictionaries.

The more specific your question the easier it is for us to answer.
What exactly is confusing you about them?
What they are? How to use them? The syntax?

> Now he has moved on to class and modules. Can you assist me please.

Lets stick with lists, tuples and dictionaries for now.

You could try reading through the Raw Materials topic in my
tutorial (see .sig below) which discusses all three - and much
more besides.


> He has given us a module to go by.
>
> It says define a new variable called MOVES that contains a dictionary.
> - I assume this means to create an empty dictionary to the variable called moves.
> MOVES = { }

I assume so too, the terminology is wrong for Python but accurate
for most languages. Python variables dont store data inside themselves, 
they are only names referring to data values(objects).

But I think you are right, he means create a variable that refers to an 
empty dictionary.

> Then it says, “As keys, use the move variable defined in the pokemon module”
> - Is keys what we use in the parameters?

Recall that dictionaries consist of key-value pairs. You access
a value by passing the dictionary a key.

It seems that you have access to a Python module called pokemon?
Within that module is a variable called move. Without knowing what that 
variable looks like its hard for me to give you any further advise, but 
somehow you are expected to map the move values to dictionary keys...

HTH
-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos



More information about the Tutor mailing list