Do note that by using and, the moment your code evaluates a False, it will skip that condition.
For example,
s = 'd'
if s == 'c' and s == 'd':
print ('pass')
else:
print ('fail')
The above code will print 'fail' because s has failed the first s == 'c' part.
However, if you change to:
s = 'd'
if s == 'c' or s == 'd':
print ('pass')
else:
print ('fail')
The above code will print 'pass' because s has failed the first s == 'c' part but will go on to evaluate the second s == 'd' part.
Now if you wish to simply exclude 'c', 'o', 'e' from your string, simply remove them from the in part:
new_str = ''
for char in 'dfdfadcodefgldfjdcodefdfepiddjcode':
if char in 'abdfghijklmnpqrstuvwxyz':
new_str += char
print (new_str)
Or you could:
new_str = ''
for char in 'dfdfadcodefgldfjdcodefdfepiddjcode':
if char not in 'coe':
new_str += char
print (new_str)
char == 'c' and char =='o'can never be true - a character only has a single value(char == 'c') and (char =='o') and (char in 'abcdefghijklmnopqrstuvwxyz') and (char == 'e')orinstead ofand?