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