0
Failed in test 3 of Pandas Pandas Pandas
I passed all the other tests except hidden question 3. I have no idea what is wrong with it?
4 Respuestas
+ 1
Without to see your code cannot be helped.
0
import pandas as pd
import numpy as np
n = int(input())
c1 = np.array([0,0])
c2 = np.array([2,2])
c1_arr = np.array([]).reshape(0,2)
c2_arr = np.array([]).reshape(0,2)
def dist(x,y):
return np.sqrt(((x-y)**2).sum())
for i in range(n):
x = np.array([[float(x) for x in input().split()]])
if dist(x,c1) <= dist(x,c2):
c1_arr = np.concatenate((c1_arr, x), axis =0)
else:
c2_arr = np.concatenate((c2_arr, x), axis=0)
print(np.round(np.mean(c1_arr, axis=0),2))
print(np.round(np.mean(c2_arr, axis=0),2))
0
Can anyone help me please
0
If the array is empty you need to print None, that's the trick for passing test 3