HTML & JS
print("Give the diamond height:")
n=int(input())
a=n//2
for x in range(-a,a+1):
    for y in range(-a,a+1):
        if(abs(x/a)+ abs(y/a) ==1):
            print("*", end='')
        else:
            print(" ",end='')
    print('')

Generated URL:

Output:

Give the diamond height:
     *     
    * *    
   *   *   
  *     *  
 *       * 
*         *
 *       * 
  *     *  
   *   *   
    * *    
     *     
Report Bug