CSS Ribbon

Reproducing the GitHub Ribbon in CSS

python小练习

读取3个数(1—50)的整数值,每读取一个值,程序打印出该值个数的*
def wrapper(f):
    def inner(*args,**kwargs):
        ret = f(*args,**kwargs) #被装饰的函数
        print('*'*int(ret))
        return ret
    return inner


@wrapper
def read_num():
    while True:
        num = input('请输入数字(范围限制1-50)>>>').strip()
        if num.isdigit() and int(num)>=1 and int(num) <=50:
            return num
        else:
            print('错误的输入,请重输')


if __name__ == '__main__':
    count = 0
    num = 3
    while count < num:
        read_num()
        count += 1
View Code

 

posted on 2018-08-07 10:33  pandaboy1123  阅读(158)  评论(0)    收藏  举报

导航