Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

create square matrix python

R = int(input("Enter the number of rows:")) 
C = int(input("Enter the number of columns:")) 
  
# Initialize matrix 
matrix = [] 
print("Enter the entries rowwise:") 
  
# For user input 
for i in range(R):          # A for loop for row entries 
    a =[] 
    for j in range(C):      # A for loop for column entries 
         a.append(int(input())) 
    matrix.append(a) 
  
# For printing the matrix 
for i in range(R): 
    for j in range(C): 
        print(matrix[i][j], end = " ") 
    print() 
Comment

PREVIOUS NEXT
Code Example
Python :: otp generation in python 
Python :: dictionary size in python 
Python :: difference between __str__ and __repr__ 
Python :: # How to Prints the current working directory in python 
Python :: how to get the current line number in python 
Python :: logging - multiple log file 
Python :: how to iterate through ordereddict in python 
Python :: bash python csv to json 
Python :: generate unique id from given string python 
Python :: django migrate not creating tables 
Python :: print all attributes of object python 
Python :: python dictionary rename key 
Python :: python float to decimal 
Python :: create a blank image cv2 
Python :: python get weather 
Python :: pyspark dropna in one column 
Python :: python requests get 
Python :: django login view 
Python :: pip in vscode linux 
Python :: convert 1 to "one" python 
Python :: numpy delete column 
Python :: how to merge two dictionaries in python 
Python :: url settings 
Python :: count characters in string python 
Python :: delete tuple from list python 
Python :: change tkinter app icon 
Python :: generate binay image python 
Python :: change default port django 
Python :: how to remove quotes from a string in python 
Python :: how to count number of columns in dataframe python 
ADD CONTENT
Topic
Content
Source link
Name
4+6 =