Hi Chris (That's 3 digits and 5 letters) Pretty easy. Do you want to distinguish between uppercase and lowercase letters?
No i really don't care for that. I just want first three should be numbers and rest 5 are characters. "123aAbBc" Can you give examples ? ---------- Forwarded message ---------- From: Chris Angelico <ros...@gmail.com> To: python-list@python.org Cc: Date: Wed, 9 May 2012 17:44:00 +1000 Subject: Re: tweaking random number On Wed, May 9, 2012 at 5:01 PM, Nikhil Verma <varma.nikhi...@gmail.com> wrote: > Hi All > > I want to generate a random number of 8 digits which involve 3 number and 5 > digits. (That's 3 digits and 5 letters) Pretty easy. Do you want to distinguish between uppercase and lowercase letters? Your current random_number function (btw, I wouldn't call it "number" as it isn't one) is most of one possible solution. Divide it into two parts, one part that generates the digits and another part that generates the letters. Your 'characters' template would thus be different for the two parts. There are other solutions, which involve the generation of less random numbers, but your way will work. ChrisA -- Regards Nikhil Verma +91-958-273-3156
-- http://mail.python.org/mailman/listinfo/python-list