Sequence_file = open("homeobox_human.fasta") # Open the target file for reading Sequence_Count = 0 # Initialise the Annotation Line Counter variable AA_Count = 0 # Initialise the Amino Acid Counter variable for Line in Sequence_file: # For each Line of Sequence_file, if Line[0] == ">": # If this is an Annotation Line, print(Line, end='') # Print the Line, Sequence_Count += 1 # Increment the Sequence Counter, else: # Otherwise, AA_Count += len(Line) - 1 # Increment the Amino Acid Counter Sequence_file.close(); # Close the file of sequences # Print the Sequence & Amino Acid Counts print("There are ", Sequence_Count, " Protein Sequences in the file") print("There are ", AA_Count, " Amino Acid Codes in the file")