import random valid_characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890" password = "" # range is a function that takes an integer as input and returns a list of # numbers from 0 up to that upper bound. For example, range(10) produces # # [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] # # Here we use range as a way to loop a certain number of times (in this case 10 # times), to produce a password of a certain length. for i in range(10): password = password + random.choice(valid_characters) print(password)