[Tutor] changing dictionary to lowercase

2011-10-27 Thread ADRIAN KELLY
Hi all, 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"} i have tried definitions=definitions.lower() regards adrian _

Re: [Tutor] changing dictionary to lowercase

2011-10-27 Thread Steve Willoughby
On 27-Oct-11 11:25, ADRIAN KELLY wrote: Hi all, 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"} i have tried definitions=definitions.lower() lower() is not a dic

Re: [Tutor] changing dictionary to lowercase

2011-10-27 Thread Joel Goldstick
On Thu, Oct 27, 2011 at 2:25 PM, ADRIAN KELLY wrote: > > Hi all, > 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"} > > i have tried definitions=definitions.lowe

Re: [Tutor] changing dictionary to lowercase

2011-10-27 Thread bob gailer
On 10/27/2011 2:25 PM, ADRIAN KELLY wrote: Hi all, 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"} There seems to be some confusion both in the question and the

Re: [Tutor] changing dictionary to lowercase

2011-10-27 Thread Alan Gauld
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 l

[Tutor] A total newbie…sorry

2011-10-27 Thread Joe Batt
I am just starting to try to learn Python on IDLE on a Mac running Python 3.2.2 (v3.2.2:137e45f15c0b, Sep 3 2011, 17:28:59) and I have come unstuck at the very beginning I tried >>> print "Hello"SyntaxError: invalid syntax>>> print 'Hello'SyntaxError: >>> invalid syntax>>> print "Hello"SyntaxE

Re: [Tutor] A total newbie…sorry

2011-10-27 Thread Nick Zarr
The syntax has changed from 2.x to 3.x. 2.x: >>> print "Hello" Hello 3.x: >>> print("Hello") Hello -- Nick Zarczynski Blog 4 ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription

[Tutor] how to calculate execution time and complexity

2011-10-27 Thread Praveen Singh
>>> splitWord('google', 2) ['go', 'og', 'le'] >>> splitWord('google', 3) ['goo', 'gle'] >>> splitWord('apple', 1) ['a', 'p', 'p', 'l', 'e'] >>> splitWord('apple', 4) ['appl', 'e'] def splitWord(word, number): length=len(word) list1=[] x=0

Re: [Tutor] how to calculate execution time and complexity

2011-10-27 Thread Abhishek Pratap
Hi Praveen I am still new to the language but here is what I would do. Sorry I can't comment on how to best check for efficiency. my_str='google' split_by= 2 [ my_str[i:i+split_by] for i in range(0, len(my_str), split_by) ] Just using a list comprehension. best, -Abhi On Thu, Oct 27, 2011 a

Re: [Tutor] how to calculate execution time and complexity

2011-10-27 Thread Christian Witts
On 2011/10/28 07:38 AM, Praveen Singh wrote: >>> splitWord('google', 2) ['go', 'og', 'le'] >>> splitWord('google', 3) ['goo', 'gle'] >>> splitWord('apple', 1) ['a', 'p', 'p', 'l', 'e'] >>> splitWord('apple', 4) ['appl', 'e'] def splitWord(w

Re: [Tutor] how to calculate execution time and complexity

2011-10-27 Thread Praveen Singh
. > Thanks Christian for your links and code > > > ___ > Tutor maillist - Tutor@python.org > > To unsubscribe or change subscription > options:http://mail.python.org/mailman/listinfo/tutor > > > Below [1] is how I would write it, which is simply a