Jun-03-2018, 12:33 PM
Hi all. I'm getting an error message when running the following code.
I'm assuming its something to do with integers not being strings and vice-versa.
User chooses whether the 10 passwords to be generated should be made from Upper/Lower/Mixed chars.
I'm assuming its something to do with integers not being strings and vice-versa.
User chooses whether the 10 passwords to be generated should be made from Upper/Lower/Mixed chars.
import string from random import * generated = 0 min_char = 8 max_char = 12 optionchar = 0 chosenchar = "" while optionchar != '1' and optionchar != '2' and optionchar != '3': print('Choose the string type for the password:') print('1 - lowercase') print('2 - UPPERCASE') print('3 - MiXeDcAsE') optionchar = input() print('You chose ' + str(optionchar)) if optionchar == 1: chosenchar == str(string.ascii_lowercase) if optionchar == 2: chosenchar == str(string.ascii_uppercase) if optionchar == 3: chosenchar == str(string.ascii_letters) while generated <10: password = "".join(choice(str(chosenchar)) for x in range(randint(min_char, max_char))) print ("This is your password: ",password) generated = generated + 1thank you