+ 1
is there anything wrong in this please answer import string from random import * letters = string.ascii_letters digits = string.digits chars = letters + digits min_length = 9 max_length = 15 password = "".join(choice(chars) for x in range(randint(min_length, max_length))) print(password)
4 Answers
+ 2
I've tested your code, and it works.
What is the error you are getting?
+ 2
I tested it in Code Playground. And your error suggests that you aren't putting proper line breaks.
Here is the code with line breaks:
import string
from random import *
letters = string.ascii_letters
digits = string.digits
chars = letters + digits
min_length = 9
max_length = 15
password = "".join(choice(chars) for x in range(randint(min_length, max_length)))
print(password)
+ 1
syntax error: multiple statements found while compiling a single statement
+ 1
where did u test it