I'm tryna make a random username generator (or at least a prototype)
Code I'm using is This:
def Usergenerator():
word1 = {
0: 'Good',
1: 'I',
2: 'yeet',
3: 'Not',
4: 'Fishe',
5: 'Xx',
6: 'Ucan',
7: 'Ultra',
8: 'Bald',
9: 'boom',
10: 'silly'
}
word2 = {
0: 'Milk',
1: 'Cat',
2: 'Dog',
3: 'poo',
4: 'ghost',
5: 'Fire',
6: 'xX',
7: 'June',
8: 'Lunar'
}
word3 = {
0: 'Foot',
1: 'Man',
2: 'Boy',
3: 'Poop',
4: 'Cell',
5: 'Wat',
6: 'Burn'
}
numbers = {
0: '12',
1: '60',
2: '45',
3: '11',
4: '22',
5: '33',
6: '78',
7: '16',
8: '55'
}
import random
a = 0
b = len(word1)
random = random.randint(a, b)
get = word1.get(random)
import random
a = 0
b = len(word2)
random = random.randint(a, b)
get2 = word2.get(random)
import random
a = 0
b = len(word3)
random = random.randint(a, b)
get3 = word3.get(random)
import random
a = 0
b = len(numbers)
random = random.randint(a, b)
get4 = numbers.get(random)
Username1 = get + get2 + get3 + get4
print(Username1)
Usergenerator()
The dictionaries maps numbers from 0 to whatever to a word There are multiple that have different mappings and lengths
it first imports random, then generates a random number, and maps the random number onto the word Then it sets "get" to the result
it does this about 4 times
Then it combines all of the give variables into one, called "Username"
then just prints Username out
this is all in a module which is then ran after its created
But I get this error:
File "c:/Users/why/are/you/here/you/creep.py", line 85, in Usergenerator
Username1 = get + get2 + get3 + get4
TypeError: can only concatenate str (not "NoneType") to str"
Aucun commentaire:
Enregistrer un commentaire