python problem in pattern | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

python problem in pattern

having problems getting the result https://code.sololearn.com/c16M4SfQqVLA/#py

9th Aug 2019, 4:53 PM
Rahul Guha
Rahul Guha - avatar
2 Answers
+ 4
It works if you multiply blanks, like this code does, this code only works for odd numbers: rows=int(input("Enter the number of rows- \n")) k_space_max=rows/2 - 1 j = 1; l = -1 for i in range(1,rows+1): if i > k_space_max + 1: j = -1 if i==1 or i == rows: print("*") else: print("*" + l * " " + "*") l += j
9th Aug 2019, 6:01 PM
Paul
Paul - avatar
0
thanks man .
10th Aug 2019, 5:09 AM
Rahul Guha
Rahul Guha - avatar