In the for
cycle there is a function to remove all duplicates, but it doesn't. Also the .upper
sometimes doesn't work. Please help.
from collections import OrderedDict
def ask():
global x
x = str(input("Enter your logical operation:"))
x = x.split( )
x = [x.upper() for x in x]
return x
ask()
for i in range(0,len(x)):
and_index = x.index("AND",i)
n = list(OrderedDict.fromkeys(str(and_index)))
print(n)
print(n)