Why this is not working? Showing no output. file can open and there are words without e in file too. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why this is not working? Showing no output. file can open and there are words without e in file too.

def no_e(word): if 'e' in word: return True else: return False file= open('words.txt') for line in file: line=line.strip() if no_e(line)==True: print(line)

12th May 2020, 3:23 PM
Neeraj Agarwal
Neeraj Agarwal - avatar
3 Answers
+ 2
Neeraj Agarwal No here it will not give error. Just file will return null.
12th May 2020, 3:44 PM
A͢J
A͢J - avatar
+ 1
Neeraj Agarwal Because file doesn't exist.
12th May 2020, 3:26 PM
A͢J
A͢J - avatar
0
Then it will show error that file or directory is not available
12th May 2020, 3:32 PM
Neeraj Agarwal
Neeraj Agarwal - avatar