Home > other >  Why use python center alignment will tilt? (an odd number of characters) some characters of two Spac
Why use python center alignment will tilt? (an odd number of characters) some characters of two Spac

Time:09-30

 import math 
A, ch=input (). The split (' ')
A=int (a)
Real=int (math. SQRT ((a + 1)/2))
Rest=int (a - 2 * real * * 2 + 1)
Real=2 * real - 1
For k in range (real, 0, 2) : print (ch * (k). The center (real, ' '))
For j in range (3, real + 1, 2) : print ((ch * j) center (real, ' '))
Print (rest)

As above, python3.8 implementation to print the hourglass
Title the following
You are asked to write a program to bear on the given symbol print into the shape of an hourglass, given 17 "*", for example, requirements in the following format to print
* * * * *
* * *
*
* * *
* * * * *
"The hourglass shape", refers to the output an odd number of symbols per line; The center line all symbols; Adjacent two rows symbol number 2; Diminishing the number symbols from big to small order at first to 1, since the childhood again increasing order. The end is the same symbol.

Given any N symbols, can not form an hourglass, just asked to print out of the hourglass can drop as many symbols,


Such as test 40 & amp;
& & & & & & &
& & & & &
& & &
&
& & &
& & & & &
& & & & & & &
9
This guy seemed to be two Spaces of python...
40!
!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!
!!!!!!!!!
!
!!!!!!!!!
!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!
9
The
40 *
* * * * * * *
* * * * *
* * *
*
* * *
* * * * *
* * * * * * *
9
Very strange, a few Spaces is right, but appear to be crooked,,,, is there a difference whether a character length and space length

CodePudding user response:

DDDDDDDDDD

CodePudding user response:

DDDDXDDDXXXXXXXDDDDD

CodePudding user response:

Should be the cause of the special characters

CodePudding user response:

Your display window set font as monospaced font should be ok
  • Related