What am I doing wrong in python?

You are using the int keyword. you have to use str
like this

1 = str(input('please enter: '))

Always use strings for password
If you need to compare it, convert it to int and the reconvert it into str

import string
import random

print("what passwords do you want to use? [please reply with soci, pers or buis for social media, personal or business respectively]")

l = input('please enter:  ' )

if l=="soci":
    total = string.ascii_letters
    length = 8
    password = "".join(random.sample(total, length))
    print("Low level password. Commonly used for social media")
    print(password)
    
if l=="pers":
    total = string.ascii_letters + string.digits
    length = 9
    password = "".join(random.sample(total, length))
    print("Medium level password. Used for personal use")
    print(password)
    
if l=="buis":
    total = string.ascii_letters + string.digits
    length = 12
    password = "".join(random.sample(total, length))
    print("high level password used for business")
    print(password)

make the imports common, default input is string, so you don’t have to mention it. You used “1” instead of “l” and it should be only one “=” before asking to enter which assigns your entry to the variable. and it should not be “int” just “input” default for string. I hope you understand. Please revert back if you need further assistance.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.