some new things, mostly not working or finished

This commit is contained in:
2025-11-08 18:16:10 +01:00
parent 5792bfbd9a
commit 795fb42900
30 changed files with 4789 additions and 1 deletions

52
functions/passwort.py Normal file
View File

@@ -0,0 +1,52 @@
import random
def passwort_zahlen(laenge):
p = ""
for _ in range(laenge):
zufallszahl = random.randint(0, 9)
p = str(p) + str(zufallszahl)
return p
def passwort_buchstaben(laenge):
p = ""
for _ in range(laenge):
buchstabe = random.choice("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
p = str(p) + str(buchstabe)
return p
def passwort_kombi(laenge):
p = ""
for _ in range(laenge):
wahl = random.choice(["zahl", "buchstabe"])
if wahl == "zahl":
zufallszahl = random.randint(0, 9)
p = str(p) + str(zufallszahl)
else:
buchstabe = random.choice("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
p = str(p) + str(buchstabe)
return p
# Hauptprogramm
def main():
print("Passwortgenerator")
print("1: Nur Zahlen")
print("2: Nur Buchstaben")
print("3: Zahlen und Buchstaben")
auswahl = input("Deine Wahl (1/2/3): ")
laenge = int(input("Wie viele Zeichen soll das Passwort haben? "))
if auswahl == "1":
passwort = passwort_zahlen(laenge)
elif auswahl == "2":
passwort = passwort_buchstaben(laenge)
elif auswahl == "3":
passwort = passwort_kombi(laenge)
else:
return
print("Passwort:", passwort)
# Programm starten
if __name__ == "__main__":
main()