0
Average of Rows end of module project from Data Science
Please I’m struggling with the input format. I have done it on my pc and it works. I’ve read the instructions over and over I’m pretty sure I’m not doing something right. Please can anyone help me? Thank you.
4 Respuestas
0
you’ll have to be more specific if you want a useful answer. why don’t you start by sharing your work or what you think you might be doing wrong?
0
fch0 when i input the rows as stated in the instruction example 1.5 1 i get invalid syntax
0
invalid syntax is a common error raised in python when there’s something wrong with your syntax like a missing colon for example, i can’t tell you much more than that without knowing what’s going on, could you paste here the line of your code that is raising it?
0
Data Science - the perfect solution for average of rows
n, p = [int(x) for x in input().split()]
import numpy as np
rm = []
for i in range(n):
for a in input().split():
rm.append(float(a))
a = np.array(rm).reshape((n,p))
c = np.mean(a,axis=1)
p = np.around(c,2)
print(p)