Getting Type Error
NickName:srinivas chaitanya Ask DateTime:2017-02-15T14:59:16

Getting Type Error

I am trying to write matrix multiplication programme.But I am getting error called "Type Error:Int Object is not iterable".This is my code

def matmult(m1,m2):
  r1=[]
  r2=[]
  for a in range(len(m2[0])):
    r1.append(0)
  for b in range(len(m1)):
    r2.append(r1)
  for i in range(len(m1)):
    for j in range(len(m2[0])):
      for k in range(len(m2)):
        r2 += m1[i][k]+m2[k][j]

I am getting error at last line of code.What could be the cause?

Copyright Notice:Content Author:「srinivas chaitanya」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/42242581/getting-type-error

More about “Getting Type Error” related questions

Python: getting type error

I'm getting a type error: TypeError: unsupported operand type(s) for -: '`tuple`' and '`float`' I have this as code: elif corner == "SW": return ((self.centerx)-(xcoord)),((self.centery

Show Detail

Getting Type Error

I am trying to write matrix multiplication programme.But I am getting error called "Type Error:Int Object is not iterable".This is my code def matmult(m1,m2): r1=[] r2=[] for a in range(len...

Show Detail

Getting Error Array Type Required

I am trying to run this code: RichViewEdit1.LineCount[i]:= Cipher.EncryptString(RichViewEdit1.LineCount[i]); And I keep getting an error: Array Type Required. Why I'm I getting this error? More...

Show Detail

Typescript: Using resizeObserver but getting type error

I am trying to use a resizeObserver and in TS, I am getting the following error: Argument of type '(element: ResizeObserverEntry) => void' is not assignable to parameter of type '

Show Detail

getting Type Error in Ajax call

In my rhomobile application am using ajax call, when I made a request am getting Type Error in console am not getting the where I did mistake. Here is my code $( document ).ready(function() { ...

Show Detail

Getting a type mismatch error

I am getting a run-time error 13 'Type Mismatch' on this chunk of code and I cannot figure out why. I have not used the Mid() function before and that is the line that throws the error. Beginner ...

Show Detail

Getting error assignable to parameter of type

I am using "rxjs": "~6.2.0" in below code block canActivate():Observable<boolean> { return this.auth.user$.pipe ( switchMap( user =>

Show Detail

Getting Type Mismatch Error

This VBA code verifies calculated cells. If the value is over $500.00 or has #N/A, then it should color the entire row and bold font. But I keep getting this Type Mismatch error: Dim lngCounter A...

Show Detail

Getting compile error: argument type mismatch error

Option Explicit Sub data() Dim a, b As String a = "demo" b = "text" Call getValue(a, b) End Sub Sub getValue(a As String, b As String) Cells(1, 1).Value = a

Show Detail

Getting invalid type comparison error

I am getting invalid type comparison error if anyone could help? Basically, I am getting an error on the line where I want to replace all "-" with zeros in the data frame, so as to make it uniform ...

Show Detail