Re: [Tutor] Musical note on python

2012-09-16 Thread D . V . N . Sarma డి . వి . ఎన్ . శర్మ
winsound.Beep() takes only integral values for frequency. Therefore you cannot use it if you want either just intonation or equal temperment scales exactly. -- regards, Sarma. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription

Re: [Tutor] All possible 16 character alphanumeric strings?

2012-09-16 Thread eryksun
On Sat, Sep 15, 2012 at 6:50 PM, Scurvy Scott wrote: > > I'm trying to generate a list of every possible 16 character string > containing only 2-7 and a-z lowercase. This type of problem is just nested iteration: >>> seq = '01' >>> r = [] >>> for g0 in seq: ... for g1 in seq:

[Tutor] How to run this block of code dozens of times

2012-09-16 Thread Scurvy Scott
Hello all, I'm just wondering how to run this block of code X amount of times (a lot) and then store the ouput to a .txt file. The code I've written is below. from Crypto.PublicKey import RSA import hashlib m = RSA.generate(1024) b = hashlib.sha1() b.update(str(m)) a = b.hexdigest() print a[:16]

[Tutor] find('') returns 0

2012-09-16 Thread Don Jennings
This behavior seems strange to me: the find method of a string returns the position zero when you search for an empty string (granted, I can't quite figure out why you'd search for an empty string, either). >>> 'abc'.find('') 0 Anyone care to share a good explantion for this behavior and possi

Re: [Tutor] How to run this block of code dozens of times

2012-09-16 Thread Scurvy Scott
scratch that, new code is below for your perusal: from Crypto.PublicKey import RSA import hashlib def repeat_a_lot(): count = 0 while count < 20: m = RSA.generate(1024) b = hashlib.sha1() b.update(str(m)) a = b.hexdigest() print a[:16] + '.onion'

Re: [Tutor] How to run this block of code dozens of times

2012-09-16 Thread Dave Angel
On 09/16/2012 07:56 PM, Scurvy Scott wrote: > scratch that, new code is below for your perusal: > > from Crypto.PublicKey import RSA > import hashlib > > def repeat_a_lot(): > count = 0 > while count < 20: You're kidding, aren't you? while loops are meant for those times when you don't kn

Re: [Tutor] find('') returns 0

2012-09-16 Thread eryksun
On Sun, Sep 16, 2012 at 7:51 PM, Don Jennings wrote: > This behavior seems strange to me: the find method of a string returns the > position zero when you search for an empty string (granted, I can't quite > figure out why you'd search for an empty string, either). > 'abc'.find('') > 0 > >

Re: [Tutor] How to run this block of code dozens of times

2012-09-16 Thread Scurvy Scott
On Sun, Sep 16, 2012 at 5:23 PM, Dave Angel wrote: > On 09/16/2012 07:56 PM, Scurvy Scott wrote: > > scratch that, new code is below for your perusal: > > > > from Crypto.PublicKey import RSA > > import hashlib > > > > def repeat_a_lot(): > > count = 0 > > while count < 20: > > >You're ki

Re: [Tutor] find('') returns 0

2012-09-16 Thread eryksun
On Sun, Sep 16, 2012 at 8:33 PM, eryksun wrote: > > The 'in' operator also searches for a substring: > > >>> '' in 'abc' > True I forgot to mention, this use of slices is a peculiarity to strings. In contrast, list.index and list.__contains__ ("in") match against individual items. An empt

Re: [Tutor] How to run this block of code dozens of times

2012-09-16 Thread Mark Lawrence
On 17/09/2012 01:56, Scurvy Scott wrote: Why would you use an underscore rather than a letter or name like I've always seen. I've never seen an underscore used before. Try reading some of the documentation here http://www.python.org/doc/ It's amazing what you can learn. -- Cheers. Mark La

[Tutor] reducing a list evenly when deleting elements by index

2012-09-16 Thread Pete O'Connell
Hi, I have a bezier line with 20 points on it and I am trying to reduce this to a line with 4 points, keeping the first and last points and 2 evenly spaced points in between like so: ** becomes: *. . . .* These points are removable only by index, so if I remove poi

Re: [Tutor] reducing a list evenly when deleting elements by index

2012-09-16 Thread Oscar Benjamin
On 17 September 2012 02:15, Pete O'Connell wrote: > Hi, I have a bezier line with 20 points on it and I am trying to reduce > this to a line with 4 points, keeping the first and last points and 2 > evenly spaced points in between like so: > ** > becomes: > *. . .

Re: [Tutor] reducing a list evenly when deleting elements by index

2012-09-16 Thread Pete O'Connell
Ah of course. Thanks very much Oscar! Pete On Mon, Sep 17, 2012 at 1:29 PM, Oscar Benjamin wrote: > On 17 September 2012 02:15, Pete O'Connell wrote: > >> Hi, I have a bezier line with 20 points on it and I am trying to reduce >> this to a line with 4 points, keeping the first and last points an

Re: [Tutor] How to run this block of code dozens of times

2012-09-16 Thread Dave Angel
On 09/16/2012 08:56 PM, Scurvy Scott wrote: > On Sun, Sep 16, 2012 at 5:23 PM, Dave Angel wrote: > >> On 09/16/2012 07:56 PM, Scurvy Scott wrote: >>> scratch that, new code is below for your perusal: >>> >>> from Crypto.PublicKey import RSA >>> import hashlib >>> >>> def repeat_a_lot(): >>> co

[Tutor] simple random string generator

2012-09-16 Thread Matthew Dalrymple
hey im new to the tutor thing so please correct me if im doing something wrong. Anyway what i am trying to do is make a simple string (word) generator and get it to make strings (or words) starting at 10 chars up to 100 in steps of 5 using a make word function. Now my problem is how do i get

Re: [Tutor] How to run this block of code dozens of times

2012-09-16 Thread Steven D'Aprano
On 17/09/12 10:56, Scurvy Scott wrote: Why would you use an underscore rather than a letter or name like I've always seen. I've never seen an underscore used before. An underscore on its own is often used to mean "don't care". Like a scratch variable to hold a result when you don't actually ne

Re: [Tutor] reducing a list evenly when deleting elements by index

2012-09-16 Thread Steven D'Aprano
On 17/09/12 11:15, Pete O'Connell wrote: Hi, I have a bezier line with 20 points on it and I am trying to reduce this to a line with 4 points, keeping the first and last points and 2 evenly spaced points in between like so: In general in Python, it is faster and much easier to create a new list

Re: [Tutor] simple random string generator

2012-09-16 Thread Steven D'Aprano
On 17/09/12 12:45, Matthew Dalrymple wrote: Anyway what i am trying to do is make a simple string (word) generator and get it to make strings (or words) starting at 10 chars up to 100 in steps of 5 using a make word function. Now my problem is how do i get it to run the mkword function and manip

Re: [Tutor] How to run this block of code dozens of times

2012-09-16 Thread Scurvy Scott
Wow, thanks Dave, et al., for explaining things the way they did. I'm not trying to and apologize for top posting, gmail wasn't giving me the option of replying to all. I definitely understand what was going on and why when you all were explaining the code portions to me. _

Re: [Tutor] How to run this block of code dozens of times

2012-09-16 Thread Peter Otten
Scurvy Scott wrote: > Actually the loop would run 2^80 times Remember the previous thread? This means the loop will not terminate in the next few million years. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: htt