Using Python, write a function called ‘gc_percent’that takes a DNA sequence as an argument and returns the percentageof the sequence that are ‘G’ or ‘C’ nucleotides. For example, ifthe DNA sequence is:
tagtacta
Then the function will return 0.25. For this problem, your programmust read the DNA sequence from a file called “fasta.txt”. Thecontents of the file are:
>monkey
tatagctacgtagcaatagcgccgatacg
Solution
def gc_percent(dna): count = 0 for i in dna: if i in ‘gc’: count = count + 1
OR
OR