Professional Documents
Culture Documents
Assignment 1
Assignment 1
2020-310-080
ASSIGNMENT 1
state_transition = []
def q0(s,i):
state_transition.append('q0')
if (len(s)==i):
return False
if s[i] == 'a':
return q1(s,i+1)
else:
return q3(s,i+1)
def q1(s,i):
state_transition.append('q1')
if len(s) == i:
return False
def q2(s,i):
state_transition.append('q2')
if len(s) == i:
return True
def q3(s,i):
state_transition.append('q3')
if len(s) == i:
return False
for i in state_transition:
print(i, end = " ")
else:
print("String Not Accepted")
Output: