0

Data Science Python Ordinary Squares Linear Regression

import numpy as np n, p = [int(x) for x in input().split()] X = [] for i in range(n): X.append([float(x) for x in input().split()]) y = [float(x) for x in input().split()] A = np.array(X) B = np.array(y) C = np.dot(A, B) print(C) I get the message "this code is missing a closing parenthesis AND my answer is wrong" Can anyone help, me, please?

29th Nov 2022, 1:51 PM
Catherine
1 Respuesta
+ 1
Catherine it looks like the first line is missing an item in the tuple assignment. There is only a single element on the right side of the assignment. The list gets assigned to n, and there is nothing left to assign to p. I think it should run if you add another call to input() in front so that n gets a single value, and the list gets assigned to p. n, p = int(input()), [int(x) for x in input().split()]
1st Dec 2022, 1:36 PM
Brian
Brian - avatar