38 lines
622 B
Python
38 lines
622 B
Python
|
|
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.")
|