import random import string def generate_password(length=12): characters = string.ascii_letters + string.digits + string.punctuation password = ''.join(random.choice(characters) for _ in range(length)) return password password_length = int(input("Geben Sie die Länge des Passworts ein: ")) generated_password = generate_password(password_length) print(f"Generiertes Passwort: {generated_password}")