Advertisement
Dar954826

Generator

Oct 22nd, 2014
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.83 KB | None | 0 0
  1. oop=bool("false")
  2. def gener():
  3.  import random
  4.  try:
  5.   global dir
  6.   global BaseRandom
  7.   global por,lka
  8.   lka=""
  9.   por=""
  10.   BaseRandom=random.randint(-99999999999999999999,99999999999999999999)
  11.   BaseRandom=str(BaseRandom)+".txt"
  12.   dir=""
  13.   import random
  14.   def assign():
  15.    
  16.    global r
  17.    r=random.randint(2,36)
  18.    if r==2 or r==3 or r==4 or r==5 or r==6 or r==7 or r==8 or r==9 or r==10 :
  19.     r=r-1
  20.     r=str(r)
  21.    elif r==11:
  22.     r="A"
  23.    elif r==12:
  24.     r="B"
  25.    elif r==13:
  26.     r="C"
  27.    elif r==14:
  28.     r="D"
  29.    elif r==15:
  30.     r="E"
  31.    elif r==16:
  32.     r="F"
  33.    elif r==17:
  34.     r="G"
  35.    elif r==18:
  36.     r="H"
  37.    elif r==19:
  38.     r="I"
  39.    elif r==20:
  40.     r="J"
  41.    elif r==21:
  42.     r="K"
  43.    elif r==22:
  44.     r="L"
  45.    elif r==23:
  46.     r="M"
  47.    elif r==24:
  48.     r="N"
  49.    elif r==25:
  50.     r="O"
  51.    elif r==26:
  52.     r="P"
  53.    elif r==27:
  54.     r="Q"
  55.    elif r==28:
  56.     r="R"
  57.    elif r==29:
  58.     r="S"
  59.    elif r==30:
  60.     r="T"
  61.    elif r==31:
  62.     r="U"
  63.    elif r==32:
  64.     r="V"
  65.    elif r==33:
  66.     r="W"
  67.    elif r==34:
  68.     r="X"
  69.    elif r==35:
  70.     r="Y"
  71.    elif r==36:
  72.     r="Z"
  73.   a=input("Codici da generare: ")
  74.   a=int(a)
  75.   a=a+1
  76.   b=input("Sequenze per codice: ")
  77.   b=int(b)
  78.   b=b
  79.   c=input("Caratteri per sequenza: ")
  80.   c=int(c)
  81.   for l in range(a):
  82.    
  83.    print(dir)
  84.    pos = dir.count(" ")
  85.    pos=pos+1
  86.    if pos==b+1:
  87.     dir=""
  88.    por=por+" "+dir
  89.    print(por)
  90.  
  91.    out_file = open(BaseRandom,"w")
  92.    
  93.    lop=por+"\n"
  94.    lop=str(lop)
  95.    out_file.write(lop)
  96.    
  97.    
  98.    dir=""
  99.  
  100.    for p in range(b):
  101.     dir=dir+" "
  102.     for d in range(c):
  103.       assign()
  104.       assign()
  105.       dir=dir+r
  106.   input("Clicca per cancellare")
  107.   print('\n'*1000)
  108.  except ValueError:
  109.   input("Devi inserire un numero, non una lettera")
  110.   print('\n'*1000)
  111.    
  112.    
  113.  
  114.  
  115.  
  116.  
  117. while oop:
  118.  gener()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement