0
python problem in pattern
having problems getting the result https://code.sololearn.com/c16M4SfQqVLA/#py
2 odpowiedzi
+ 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
0
thanks man
.