Creating 26 A's followed by another 26 B's up to 26 Z's

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Asamoah Michael
    New Member
    • Jun 2015
    • 1

    Creating 26 A's followed by another 26 B's up to 26 Z's

    Creating 26 A's followed by another 26 B's up to 26 Z's
  • kiseitai2
    New Member
    • Jul 2007
    • 93

    #2
    Could you post some code samples of what you have tried?

    Comment

    • computerfox
      Contributor
      • Mar 2010
      • 276

      #3
      I don't exactly see a question. Are you getting an error?

      Here's a sample in Python:
      Code:
      #!/bin/python
      import random;
      
      def right_pad(mstr,mlen,mpad):
       final="";
       if len(mstr) < mlen:
        i=len(mstr);
        while i < mlen:
         final=final+mpad;
         i+=1;
        return mstr+final;
       else:
        return mstr.substr(0,mlen);
      
      class class26:
       id=None;
       max=26;
       chars_raw="A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z";
       chars=chars_raw.split(",");
      
       def __init__(self):
        self.id=right_pad(str(random.randint(20,1000)),10,"0");
      
       def run(self):
        i=0;
        while i<len(self.chars):
         j=0;
         row_str="";
         while j<self.max:
          row_str=row_str+self.chars[i];
          j+=1;
         print row_str;
         i+=1;
      
      session=class26();
      print session.id;
      session.run();


      Please note that we will not do your homework/classwork/work assignment for you.

      Comment

      Working...