# -*- coding: UTF-8 -*- """ 打印出如下图案(菱形): * *** ***** ******* ***** *** * """ def __print__(n): for i in range(n / 2): print " " * (n / 2 - 1 - i) + "*" * (2 * i + 1) for i in range(n / 2-1, 0, -1): print " " * (n / 2 - i) + "*" * (2 * i-1) __print__(19)
未作奇数偶数判断