擅长:python、mysql、java
<pre><code>def congurent(self,other):
ratio = None
for a,b in zip(self,other):
if a != 0 and b != 0:
if ratio is None:
ratio = a/float(b)
elif abs(ratio - a/float(b))>0.001:
return False
elif a!=0 or b!=0:
return False
return True
</code></pre>
<p>可能有点像Python。。。虽然它真正的变化是如何迭代列表(它的行数相同)</p>