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

[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

[Tutor] 12 hr to 24 hr time conversion

2011-10-26 Thread Praveen Singh
How can i convert this- >>>time24hr('12:34am') '0034hr' i searched in date module but i am not able to figure out what how to do this... ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailm

[Tutor] How to print corresponding keys in Dictionary

2011-10-24 Thread Praveen Singh
In Dictionary- How to print corresponding keys if the values of dictionary is given?? -d={'a':1,'b':2,'c':3} -i can print the corresponding values by using get() method- - d.get('a') -1 What if i have to print reverse??? ___ Tutor maillist - Tutor@pyt

[Tutor] functions and default argument

2011-10-21 Thread Praveen Singh
In function- "Default value is *evaluated only once*.This makes different when the default is a mutable object such as a list, dictionary or instance of most classes." I am not getting it properly-evaluated once?? different behaviour???-- please explain this. _

[Tutor] problem with using set

2011-10-13 Thread Praveen Singh
i have two questions- 1.>>> removeLetter("hello", "l") >>>'heo' To tackle this problem i am using set so that i can remove duplicates. def removeLetter(word,letter) set(word).remove(letter) return ''.join(set(word)) I am not getting right answer.I think i am not using sets correctly.pl

[Tutor] I am trying to print list elements but i am getting 'none'

2011-10-10 Thread Praveen Singh
This is my code- def getNumbers(num): myList=[] for numbers in range(0,num,2): print myList.append(numbers) output- >>> getNumbers(10) None None None None None Then i find out that list.append doesn't return anything.Then what should i use for this kind of operation.but if i d

[Tutor] Help me in this programme

2011-10-06 Thread Praveen Singh
this is one of the problem based on list which i found at pyschool. CountWords("google") [('e',1),('g',2),('l',1),('o',2)] by the level of this question you can easily understand i am new in python.the problem i am facing is how to make set of word and count(e,1) and add this to list?? __

[Tutor] where to look for python codes

2011-09-29 Thread Praveen Singh
i am a beginner in python.i am not asking about any books here.As i have heard one essential steps of learning is to look for some good python codes.So, can you guys please and please suggest me some sites or some small projects where i can find these codes?? please remember i am at a BEGINNER's le