Python: TypeError: cannot concatenate ‘str’ and ‘int’ objects

There are two ways to fix the problem which is caused by the last print statement. You can assign the result of the str(c) call to c as correctly shown by @jamylak and then concatenate all of the strings, or you can replace the last print simply with this: in which case isn’t necessary and can be deleted. Output of sample run: with:

Print ArrayList

I have an ArrayList that contains Address objects. How do I print the values of this ArrayList, meaning I am printing out the contents of the Array, in this case numbers. I can only get it to print out the actual memory address of the array with this code:

How to print the array?

What you are doing is printing the value in the array at spot [3][3], which is invalid for a 3by3 array, you need to loop over all the spots and print them. This will print it in the following format if you want more exact formatting you’ll have to change how the printf is formatted.