0

import cs50

`while True:`
  ` n = cs50.get_int("enter size:")`
  ` if n >= 0 and n <= 100 :`
       ` break`



for i in range(n + 1):
    print(" " *(n - i), end ='')

    print("#" * i, end = '')

    print(" " * 2, end = '')

    print("#" * i, end = '')

    print(" " * (n - i), end = '')

    print()`

enter size:4

   #  #   
  ##  ##  
 ###  ### 
####  ####
1

Your first line printed has i being 0, so you print spaces only. Change to range(1, n + 1) to avoid that.

BTW, you should not print spaces at the end of the line. As much as I like the symmetry, the checker doesn't.

1
  • oh i see . thanks for the help.
    – user21692
    Jun 27 '18 at 15:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .