current position:Home>Python printing hollow diamond

Python printing hollow diamond

2022-02-03 01:55:56 CSDN Q & A

Programming , Enter the height of the diamond , Output a diamond outlined by an asterisk .

Input format
Row number ( Positive integer )

Output format
If the number of rows is odd , The diamond outlined by the asterisk , Otherwise, an error message is displayed .

sample input 1
5
sample output 1
*

  • *
  • *
  • *
  • sample input 2
    8
    sample output 2
    Error



Refer to the answer 1:

It should show a hollow diamond , But I don't know why the problem is chaotic ……




Refer to the answer 2:

copyright notice
author[CSDN Q & A],Please bring the original link to reprint, thank you.
https://en.primo.wiki/2022/02/202202030155544795.html

Random recommended