其他分享
首页 > 其他分享> > 用字母打印菱形

用字母打印菱形

作者:互联网

num1=list(range(1,10,2))
num2=list(range(7,0,-2))

list1=num1+num2
#print(list1)
for j in list1:
print(("*" *j).center(10))

for i in list1[:5]:
print((chr(ord(“A”)+(i-1)//2)*i).center(9))
for i in list1[5:]:
print((chr(ord(“E”)+(9-i)//2)*i).center(9))
在这里插入图片描述

标签:10,center,num2,字母,打印,list1,菱形,print,num1
来源: https://blog.csdn.net/m0_56852291/article/details/122692686