[SOLVED](by master)[code error] Help me find the mistake?? | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 27

[SOLVED](by master)[code error] Help me find the mistake??

In a matrix, or 2-d array X, the averages (or means) of the elements of rows is called row means. Task Given a 2D array, return the rowmeans. Input Format First line: two integers separated by spaces, the first indicates the rows of matrix X (n) and the second indicates the columns of X (p) Next n lines: values of the row in X Output Format An numpy 1d array of values rounded to the second decimal. 2 2 1.5 1 2 2.9 Sample Output [1.25 2.45] https://code.sololearn.com/c6EK5toPx4YV

13th Aug 2021, 10:02 AM
SωAti
SωAti - avatar
25 ответов
+ 12
Sω(ᗒ✧ᕙ☞Aᕗ✧ᗕ)ti Use mean function instead of self calculated average. import numpy as q n, p = [int(x) for x in input().split()] a = [] while n > 0: #s = sum([float(x) for x in input().split()]) s = q.array(input().split(), dtype = float) mean = s.mean() a.append(round(mean, 2)) n -= 1 print(q.array(a))
13th Aug 2021, 11:37 AM
A͢J
A͢J - avatar
+ 9
A͢J - S͟o͟l͟o͟H͟e͟l͟p͟e͟r͟ thx master it's solved I still don't understand it totally 🤣 Soi I will study more of your code!! Thanks anyway 😊
13th Aug 2021, 11:47 AM
SωAti
SωAti - avatar
+ 9
mycrochip thank u so much your code run purely good Thank u for giving it so much time I appreciate it more than anyone else in today😀
13th Aug 2021, 12:08 PM
SωAti
SωAti - avatar
+ 9
mycrochip that's too much brother I can't take it .🤣🤣🤣 I thanked u earlier cause u won't feel bad As we all r living beings so we can give a little mental happiness to everybody #no_more_than_that😅
13th Aug 2021, 12:16 PM
SωAti
SωAti - avatar
+ 9
mycrochip lots of laate n mukke If u continue Lol!!!
13th Aug 2021, 12:26 PM
SωAti
SωAti - avatar
+ 7
mycrochip brother ☹️ thanks for try but!! 1) output should be an array 2)your code is very complex ....a little bit hard for me to read 3) your code generate 5_test_error🥺
13th Aug 2021, 11:32 AM
SωAti
SωAti - avatar
+ 5
I'm on it
13th Aug 2021, 10:37 AM
mycrochip
mycrochip - avatar
+ 4
13th Aug 2021, 11:23 AM
mycrochip
mycrochip - avatar
+ 4
Hmm ..
13th Aug 2021, 11:35 AM
mycrochip
mycrochip - avatar
+ 4
Click the link again. I have converted my result to an array. If it works, I'll explain further. Test it for now
13th Aug 2021, 11:38 AM
mycrochip
mycrochip - avatar
+ 4
Ok. Good. You're welcome. Anyways, the below will receive any number of rows and columns: https://code.sololearn.com/cYvU5H4AUuq3/?ref=app
13th Aug 2021, 12:04 PM
mycrochip
mycrochip - avatar
+ 4
😊 You're welcome. I learned a lot too
13th Aug 2021, 12:08 PM
mycrochip
mycrochip - avatar
+ 4
Caleb Guerra Ortega Molina Sánchez So learn python and Know NumPy. Btw how did you know "NumPy" if you don't know?
13th Aug 2021, 2:04 PM
A͢J
A͢J - avatar
+ 3
Firstly, you are required to receive three row inputs 1.) n_rows, n_cols --> np.shape() 2.) row_1: [00 01] --> row_0, col_0; row_0, col_1 3.) row_2: [ 10 11 ] --> row_1, col_0; row_1, col_1
13th Aug 2021, 10:33 AM
mycrochip
mycrochip - avatar
+ 3
Do you have some of the sample test...
13th Aug 2021, 11:36 AM
mycrochip
mycrochip - avatar
+ 3
Oh. I see. I will loop through the number of rows
13th Aug 2021, 11:40 AM
mycrochip
mycrochip - avatar
+ 3
I will walk you through all the steps block by block when you're free.
13th Aug 2021, 12:09 PM
mycrochip
mycrochip - avatar
+ 3
Sω(ᗒ✧ᕙ☞Aᕗ✧ᗕ)ti Then mukka laat 😁😁😁
13th Aug 2021, 1:55 PM
A͢J
A͢J - avatar
13th Aug 2021, 2:00 PM
CGO!
CGO! - avatar
+ 3
A͢J - S͟o͟l͟o͟H͟e͟l͟p͟e͟r͟ I look the word very much times😅😅😅😅
13th Aug 2021, 2:41 PM
CGO!
CGO! - avatar
Актуальное сегодня
python
1 Votes
Feed
0 Votes
Challenge
2 Votes
Problem
0 Votes