Question: Ex: If the input is: 3 1 5 4 3 2 4 8 6 7 5 2 2 3 9 1 6 then the output

Ex: If the input is:
31543248675223916
then the output is:
All numbers: [[15,43,24],[8,6,7],[5,22,39,16]]
Sum of each row: [82,21,82]
Note: sum(a_list) returns the sum of all the elements in a_list given that a_list contains numbers only.
num_rows = int(input())
data_list =[]
for i in range(num_rows):
data_list.append([int(x) for x in input().split()])
computed_list =
print(f'All numbers: {data_list}')
print(f'Sum of each row: {computed_list}')

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!