I'm making a code generator based on the popular game Among US, which has 4-letter game codes. I built this program to generate one for you, to see if it actually exists, but instead of four letters, only one gets generated four times.
How can I fix this? Thanks in advance!
import random
chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
quantity = int(input('How many codes do you want? '))
def create_code():
for c in range(4):
code = ''
code += random.choice(chars)
return code
for i in range(0, quantity):
print('Your code is', create_code())