Make an array b of size 6 × 4 that has 3 on the leading diagonal and 1 everywhere else. (You can do this without loops.) in python
SOURCE CODE
a=[[3,1,1,1],[1,3,1,1],[1,1,3,1],[1,1,1,3],[1,1,1,1],[1,1,1,1]]
for i in a:
for j in i:
print(j, end=" ")
print()
OUTPUT SCREENSHOT
The code is written in python3.
please give a upvote if u feel helpful.
Get Answers For Free
Most questions answered within 1 hours.