def countHashedLines(lines):
    tally = 0
for line in lines:
    if line.startswith('#'):
        tally += 1
return tally
infile = open('code.py', 'r')
all_lines = infile.readlines()
num_hash_nums = countHashedLines(all_lines)
infile.close()
How do I count the number of lines that are full-line comments in python?