Skip to content

Instantly share code, notes, and snippets.

@flosommerfeld
Last active November 20, 2016 17:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flosommerfeld/9e6a31b6f3c31a0be218304af0647363 to your computer and use it in GitHub Desktop.
Save flosommerfeld/9e6a31b6f3c31a0be218304af0647363 to your computer and use it in GitHub Desktop.
just some simple codegenerators for a project
import random
#Codegenerator 1:
value = ["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","0","1","2","3","4","5","6","7","8","9"]
digit1 = random.randint(0,35)
digit2 = random.randint(0,35)
digit3 = random.randint(0,35)
digit4 = random.randint(0,35)
digit5 = random.randint(0,35)
finishedCode = value[digit1] + value[digit2] + value[digit3] + value[digit4] + value[digit5]
print(finishedCode + " Codegenerator 1")
#Codegenerator 2:
code = ""
counter = 0
letter = ["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"]
number = ["0","1","2","3","4","5","6","7","8","9"]
while counter < 5:
letterOrNumber = random.randint(0,1) # 0 = letter, 1 = number
if letterOrNumber == 1:
code += letter[random.randint(0,25)]
counter += 1
else:
code += number[random.randint(0,9)]
counter += 1
print(code +" Codegenerator 2")
#Codegenerator 3:
def codeGen():
werte = ["B","C","D","F","G","H","J","K","M","N","P","Q","R","T","V","W","X","Y","2","3","4","5","6","7","8","9"]# steam-like
digit1 = random.randint(0,25)
digit2 = random.randint(0,25)
digit3 = random.randint(0,25)
digit4 = random.randint(0,25)
digit5 = random.randint(0,25)
code = werte[digit1] + werte[digit2] + werte[digit3] + werte[digit4] + werte[digit5]
return code
var = codeGen()
print(var+" Codegenerator 3 (Steam)")
#Codegenerator 4:
randomCode = ""
for i in range(0, 5, 1):
randomCode += random.choice("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")
print(randomCode +" Codegenerator 4")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment