# Same output as solution but can't pass

i,

My code for the #2 problem of " Distance Between Points - 3D" is different from Codecademy’s (as provided by “View Solution”). But mine couldn’t pass.
Not sure what’s the issue…

Thanks a lot!

YS

You haven’t linked to the exercise. Is it specified in the instructions that the numbers in the lists are expected to be integers only? If the lists can have decimal numbers, then your code will give a different output than the Codecademy solution code. e.g.

``````star_wars = [125.25, 1977, 11000000]
raiders = [115.56, 1981, 18000000]
mean_girls = [97.89, 2004, 17000000]
``````

will give different output for the two codes.

Also, your function’s name is `distance`, but you have also used another variable with the name `distance` within the function. That isn’t a good idea.

Hi ,

It didn’t say the numbers have to be integers. My code printed floats, and so did Codecademy’s.

I’ve also renamed one of the “distances”.

Solved. I reported it as a bug and passed the code verification. Thanks a lot!

``````# Your code:
(int(movie1[i])-int(movie2[i]))**2

# Solution code:
(movie1[i] - movie2[i]) ** 2
``````

If the numbers in the lists are floats, your code will produce a different output than the solution code (because you are converting the floats to ints before finding the difference between them).

``````a = [31.56, 54.19, 99.88]
b = [12.63, 98.54, 73.05]

# Solution code
print(distance(a,b))
# 55.182572430070714