My task is to: "Write a program that reads and prints out all lines that start with a given letter. The file path and starting letter will be given as command-line arguments. You may assume that all command-line arguments will be valid"
e.g.
$ cat cats.txt
calico
siamese
ginger
cute, cuddly
$ python3 filter.py cats.txt c
calico
cute, cuddly
$ python3 filter.py cats.txt g
ginger
My code right now looks like:
import sys
with open("cats.txt", "r") as f:
a = f.readlines()
word_no = 0
l = len(a) - 1
while word_no <= l:
if (a[word_no][0]) == sys.argv[1]:
print (a[word_no])
word_no += 1
However, I'm not passing the test cases as my code shows up with no output, even though it works with the sample textfile?

for line in f: if f.startswith(sys.argv[2]): print(line.strip())- strip to avoid \n\nsys.argv[2],sys.argv[0]is'filter.py'