Skip to content
Advertisement

How to write diagonal spaced print pattern in python [closed]

if n=2

JavaScript

if n=3

JavaScript

This code i written for. But this code is half this only print row and column not space condition.

JavaScript

Advertisement

Answer

You should remove i = 0, i += 1, j = 0, and j += 1. These operations happen by default in for loops.

JavaScript

Or you can make your string first, then print it:

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement