import random def gen(): characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!123$4%5^6&7*8(9)0_-+=' length = input('What is the password length? It must be between 8 and 24 characters: ') length = int(length) if length < 8: print ('Your password must be 8 - 24 charcters long!') gen() elif length > 24: print ('Your password must be 8 - 24 charcters long!') gen() else: password = '' for c in range(length): password += random.choice(characters) print(password) gen()
There’s something wrong with this code and i don’t know know what. The error that keeps showing up is as follows. ‘TypeError: gen() missing 1 required positional argument’. I don’t know why this keeps happening. If anyone can help then it would be greatly appreciated. I’m trying to make the code create a random string with the characters provided. The error is on line 24.