Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (50.2k points)

I want to create a 3 x 6 zero matrices using python not numpy and for the result to look exactly like this:

Matrix 3 by 6 with 0's:

00 00 00 00 00 00

00 00 00 00 00 00

00 00 00 00 00 00

1 Answer

0 votes
by (107k points)

Refer to the below code:

rows, cols = 3,6

my_matrix = [([0]*cols) for i in range(rows)]

Explanation:

This [0]*cols) produces a one-dimensional list of zeros.

For more information regarding the same, do refer to the Python tutorial that will help you out in understanding the topic in a better way.

1.2k questions

2.7k answers

501 comments

693 users

Browse Categories

...