added shakersort algorithm

This commit is contained in:
2022-05-21 13:49:18 +02:00
parent 52ad9376fe
commit 08a915aeb2
3 changed files with 74 additions and 0 deletions

6
automata/recog.py Normal file
View File

@@ -0,0 +1,6 @@
userin=input("Kennwort eingeben: ")
if userin=="abc":
print("Passwort akzeptiert.")
else:
print("Authentifizierung fehlgeschlagen.")

View File

@@ -0,0 +1,37 @@
states={0:"z1",1:"z2",2:"f"}
active=True
activestate=0
intext=""
print("Alphabet: a, b .")
print("Im Endzustand beendet '.'")
while active:
print("Zustand: " +states.get(activestate))
userin = input("Eingabe: ")
if activestate==0:
if userin == "a":
activestate=1
intext=intext+userin
else:
pass
elif activestate==1:
if userin == "b":
activestate=2
intext=intext+userin
else:
pass
elif activestate==2:
if userin == "a":
activestate=1
intext=intext+userin
elif userin == ".":
intext=intext+userin
active=False
else:
pass
print("Eingabe " + intext + " akzeptiert.")