Python: Create a 3X3 grid with numbers
Create 3x3 Grid with Numbers
Write a Python program to create a 3X3 grid with numbers.
Visual Presentation:
Sample Solution:
Python Code:
nums = []
for i in range(3):
nums.append([])
for j in range(1, 4):
nums[i].append(j)
print("3X3 grid with numbers:")
print(nums)
Sample Output:
3X3 grid with numbers: [[1, 2, 3], [1, 2, 3], [1, 2, 3]]
Flowchart:
Python Code Editor:
Previous: Write a Python program to create a multidimensional list (lists of lists) with zeros.
Next: Write a Python program to read a matrix from console and print the sum for each column. Accept matrix rows, columns and elements for each column separated with a space(for every row) as input from the user.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics