[Tutor] changing dictionary to lowercase

Alan Gauld alan.gauld at btinternet.com
Fri Oct 28 01:46:55 CEST 2011


On 27/10/11 19:25, ADRIAN KELLY wrote:

> is it possible to change a dictionary list to lowercase..without having
> to retype?
> e.g. definitions={"Deprecated": "No longer in use", "Depreciation":
> "fall in value of an asset"}

You've posted a few similar type questions lately that look suspiciously 
like homework exercises. If that is the case we are still happy to help 
but we try to avoid giving you the answer directly.
And we do like to see what you have tried first.

> i have tried definitions=definitions.lower()

Thats a start but as you found out doesn't even execute.

Others have suggested some options but it would help us if you tell us 
which version of Python you are using because Python 3 offers some 
different mechanisms to Python v2. (You can tell us the OS too for 
completeness but it probably doesn't make much difference for the 
questions you have been asking)

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



More information about the Tutor mailing list