Hello,how can I make the 2 for`s to work at the same time to find out the diferences between A and B ? Thank you.

A = "gtggcaacgtgc"
B = "gtagcagcgcgc"
C = "gcggcacagggt"
D = "gtgacaacgtgc"
def cromo(a, b):
inc = 0
for i in a:
for j in b:
if i != j:
inc = inc + 1;
print inc
cromo(A, B)

# python 2
A = "gtggcaacgtgc"
B = "gtagcagcgcgc"
C = "gcggcacagggt"
D = "gtgacaacgtgc"
def cromo(a, b):
assert len(a) == len(b)
return sum(a[i] != b[i] for i in xrange(len(a)))
print cromo(A, B)

Boolean values can be summed, with True=1 and False=0.

Only one for loop would be used because you want to access the same relative position in each string. Also, do not use "i" as a variable name as it looks too much like the number 1.

def cromo(a, b):
inc = 0
if len(a) != len(b):
print "both strings must be the same length"
return -1
for ctr in range(len(a)):
if a[ctr] != b[ctr]:
inc = inc + 1
print inc
return inc
A = "gtggcaacgtgc"
B = "gtagcagcgcgc"
print cromo(A, B)

I need to comput and display the sum and average of the cubes of the even natural numbers between 2 and n. Where n is entered by the user. Im stuck on how to average the sum of the cubes. Help Please. This is what I have so far.