Unexpected indentation error


## Random password generator between length 7 and 10 characters

from random import randint


#list to store numbers
password = []

#string to store password

rand_pass =""

#keeping track of number of characters
count = 0

#generating the length of password
count_number = randint(7,10)

print ("the length of the password is", count_number)

def random_password():
    global count
    global numbers

    while count != count_number:

    #  random number generator in a certain range
        numbers  = str(randint (33,126))
        print ("random number generated",numbers)

    # numbers appended to list
        password.append(numbers)

    # recording number of characters
        count += 1

print ("password",password)

    for numbers in password:

    #converting from str to int
        converted= int(numbers)
        print("from string to integer", converted)

    #converting from integers to letter or character
        characters = chr(converted)
        print("from integers to letters", characters)

    # adding all the converted characters to a string
        rand_pass = rand_pass + str(characters)



print ("the", count_number,"character random password is", rand_pass)



I am getting unexpected indentation here, please help,

looking at that line and the lines above:

        count += 1

print ("password",password)

    for numbers in password:

the print has no indention all of sudden, which is a bit odd

1 Like

oh ok I see it now, it is outside the function.

Thanks