0

Hi. Could you please tell me what is wrong with this code?(expected an indented block(line4))

n, p = [int(x) for x in input().split()] lista = [] for i in range(n): lista.append(input().split()) print(np.array(lista).astype(np.float16).mean(axis=1).round(2))

13th Oct 2021, 9:30 AM
Tree
Tree - avatar
5 Réponses
+ 5
You need to care about indentation when you're using loops or decision statements(if-else) n,p= [int(x) for x in input().split()] lista = [] for i in range(n): lista.append(input().split()) print(np.array(lista).astype(np.float16).mean(axis=1).round(2))
13th Oct 2021, 9:55 AM
Simba
Simba - avatar
+ 2
Maybe you missed to import numpy module. import numpy as np
13th Oct 2021, 10:21 AM
Simba
Simba - avatar
+ 1
Thank you very much
13th Oct 2021, 10:23 AM
Tree
Tree - avatar
0
In my opinion, a completely understandable warning: "Indented block is expected (line 4)" 🤔 Don't you know what "indentation" is? You've even been told the line 4 you should to indent.
13th Oct 2021, 10:04 AM
Solo
Solo - avatar
0
Thanks Simba. But it says that np is undefined(line5)
13th Oct 2021, 10:13 AM
Tree
Tree - avatar