[Tutor] simple random string generator
computer_dude15 at hotmail.com
Mon Sep 17 23:40:26 CEST 2012
> Did you look for bugs before trying to time it? For example, did you
> intend that it test the sizes from 10 thru 195 in steps of 5, or did you
> intend from 10 to 100, as you stated in your first post?
> Would you care to add a docstring to those functions to indicate what
> they're intended to do? i think maybe the anagramSolutionX functions
> are supposed to return True if the two strings contain the same letters
> (including the same number of duplicates) in an arbitrary order.
> Are you interested in faster algorithms for such a comparison? I think
> that function could be implemented in two lines of Python, using only
> builtin functions. And that includes the def line.
> Did you intend to put the timings for anagramSolution2 into solu1, and
> the timings for anagramSolution1 into solu2, and thus print them out in
> reverse order? it makes it hard to see what difference incremental
> changes might make.
> its for a class...we were given the anagramSolutionX functions...we have to comapre those using time.time() and get accurate reading by running each function at least 10000 times to each word from 10 to 100 in steps of 5. i went up to 200 just to see if one would increase faster as the number increased but it didn't...also i realized i had the solutions labled wrong so i was starting to switch them and didnt finish :S sorry... before i started trying to time it, it ran creating words from 10-100 in steps of 5... make sense? the assignment we were given was to create a mkword(n) function and get it to generate the strings from 10-100 in steps of 5 and check to see which solution would be faster...
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor