The problem is: Write a function [D,P,F]=formalConvert(S) to extract D and P then convert the statement S from Exercise 1. excluded (f) to formal form F. Hint: D contains the words between For all/ Exist/ There is at least one and a comma (,); P contains the words after the first word from the comma (,). And here is my code: S = ['For all fishes, they need water to survive', 'Exist a person, who is left handed', 'Exist an employee in the company, who is late to work everyday', 'For all fishes in this pond, they are Koi fish', 'There is at least one creature in the ocean, it can live on land', 'Every students in class A did not pass the test' ] A = ['For all ', 'Exist a ', 'Exist an ', 'There is at least one '] def formalConvert(S): F = 'Formal form : For all x in D, P(x)' arr = S.split(', ') for a in A: if (arr[0].find(a) != -1): D = arr[0].replace(a, '') P = ' '.join(arr[1].split()[1:]) else: arr1 = s.split(' did not ') D = arr1[0].replace('Every ', '') P = arr1[1].replace('pass', 'did not pass') return [D, P, F] for s in S: print(formalConvert(s)) which results in the following error: Traceback (most recent call last): File "d:\lab3\ex2.py", line 26, in <module> print(formalConvert(s)) ^^^^^^^^^^^^^^^^ File "d:\lab3\ex2.py", line 20, in formalConvert P = arr1[1].replace('pass', 'did not pass') IndexError: list index out of range Continue reading...