Question: When I run the code, G_count, C_Count, GC_count and strand_length hold values (i tried printing them) but when I try and print GC_average it will
When I run the code, G_count, C_Count, GC_count and strand_length hold values (i tried printing them) but when I try and print GC_average it will only print O. Confused why if all my other variables are holding values why the simple divide will result in 0? #!/usr/bin/env python def GC_content(str): dna_file = open(str) dna_read = dna_file.readlines() i = 1 while i < len(dna_read): strand = dna_read[i] strand_length = len(strand) G_count = strand.count("G") C_count = strand.count("C") GC_count = G_count + C_count GC_average = GC_count/strand_length i = i + 2 GC_content("insert.fasta") Content of the insert.fasta:
>1 ACGATACAAAGTAAGACAAAAGATATTATATACACAAAATTATAGGAAACGACCCAACCCTATAGG >2 CCAGATACAGATATATAGACACAATATGACAAAATATAT >3 ACAAATTTAGAGAGAGAAAAAAAAAATTATATCAATATATA >4 ACATGGGGAAAAAAAAAAAAAATACATTGGGGAACAATA
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
