[Solved] Average Innings Score in python


The way you are taking input is wrong

When you do this s[i][j]=int(input()) you are converting two space separated ints to a single int

def avg(s,n):
  sum1=0
  sum2=0
  for i in range(0,n):
      for j in range(0,2):
          if j%2==0:
             sum1+=s[i][j]
          else:
             sum2+=s[i][j]
  print((float)(sum1/n))
  print((float)(sum2/n))
n=int(input())
c=2
# I am going to ask for user input n times, split the input every time and convert individual score to int 
s=[list(map(int, input().split())) for _ in range(n)]
avg(s,n)
2
100 200
200 300
150.0
250.0

2

solved Average Innings Score in python