python练手_23-画菱形

# -*- coding:utf-8 -*-
# @Author: CH
"""
@project: python study
@time:
@detail:
@else: DO NOT STOP STUDYING!!!
"""
# 题目 打印出如下图案(菱形):
def draw(num):      #定义一个函数
    a="*"*(2*(4-num)+1)
    print(a.center(9,' '))
    if num!=1:
        draw(num-1)
        print(a.center(9,' '))
draw(4)

你可能感兴趣的:(python练手_23-画菱形)