Advertisements
Advertisements
प्रश्न
Write and call a Python function to read lines from a text file STORIES.TXT and display those lines which doesn’t start with a vowel (A, E, I, O, U) irrespective of their case.
कोड लेखन
Advertisements
उत्तर
def display_non_vowel_lines():
with open("STORIES.TXT", "r") as file:
print("Lines that don't start with a vowel:")
lines = file.readlines()
for line in lines:
if line[0].lower() not in 'aeiou':
print(line)
display_non_vowel_lines()shaalaa.com
या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
