Sep-29-2018, 03:32 AM
Use python tags when posting code to preserve the indents, which are important. I added them (and output tags) for you this time. See the BBCode link in my signature below for how to do it yourself.
First, your if statement is wrong.
Note that you don't want to exclude the other rows, you want to print blank rows instead. So you will want an else statement to print the blank row.
The simplest way to add the space in between the asterisks would be
First, your if statement is wrong.
i % 3 or 5
is equivalent to (i % 3) or (5)
, and 5 is always true. More details are here. You want i % 3 or i % 5
.Note that you don't want to exclude the other rows, you want to print blank rows instead. So you will want an else statement to print the blank row.
The simplest way to add the space in between the asterisks would be
i * '* '
. You could also do ' '.join(['*'] * i)
, which wouldn't leave a trailing space. Note that j would have be calculated differently with spaces, since the rows would be wider. Of course, you don't even need j. You can calculate j from i.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures