函数嵌套之 打印分割线

1、

需求1

定义一个print_line函数能够打印*组成的一条分割线

def print_line(char):

  print("*" * 50)

需求2

定义一个函数能够打印 由任意字符组成的分割线

def print_line(char):

  print(char * 50)

需求3

定义一个函数能够打印 任意重复次数 的分割线

def print_line(char,times):

  print(char * times)

需求4

定义一个函数能够打印5行分隔符,分割线要求符合需求3

猜你喜欢

转载自www.cnblogs.com/runxiaobao/p/12354245.html