Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

print 2d array in python

for i in A:
    print('	'.join(map(str, i)))
Comment

function to print elements from 2d array

void printElements(int* arr,int r,int c){
	for (int i = 0; i < r; ++i){
		for (int j = 0; j < c; ++j){
			cout<<( *((arr + i * c) + j))<<" ";
		}
		cout<<"
";
	}
	return;
}

// To call this function:
printElements(*array, row, column);
Comment

neat way to print 2d array

import numpy as np
A = [['A', 'B'], ['C', 'D']]
print(np.matrix(A))
Comment

print 2d array

2-D Vectors


vector<vector<int>> vect;

for (int i = 0; i < vect.size(); i++)
    {
        for (int j = 0; j < vect[i].size(); j++)
        {
            cout << vect[i][j] << " ";
        }   
        cout << endl;
    }
Comment

PREVIOUS NEXT
Code Example
Python :: Redirect the Python Script Output to File 
Python :: attributes in python 
Python :: python string contains substring ignore case 
Python :: model checkpoint 
Python :: How to Access Items in a Set in Python 
Python :: py array contains 
Python :: python delete key if exists 
Python :: list programs in python 
Python :: print in python 
Python :: prime numbers upto n in python 
Python :: tree implementation in python 
Python :: docker compose cron 
Python :: operator overloading python 
Python :: how to add pagination in discord.py 
Python :: list peek python 
Python :: how to make loops in python 
Python :: start index from 1 in python 
Python :: loading bar in python 
Python :: discord py join and leave call 
Python :: python strip function 
Python :: python list operation 
Python :: python how to switch between true and false 
Python :: linked list in merge sort python 
Python :: python calculator 
Python :: single line return python 
Python :: plotly change legend name 
Python :: how to use the sleep function in python 
Python :: run python on android 
Python :: catching exceptions in python 
Python :: remove item in dict 
ADD CONTENT
Topic
Content
Source link
Name
9+3 =