python 打印杨辉三角、冒泡排序;

三角:

 

 

 

冒泡排序:

numlist = [1,9,8,5,6,7,4,3,2]
length = len(numlist)
for i in range(length):
    for j in range(length-1-i):
        if numlist[j]>numlist[j+1]:
#            numlist[j],numlist[j+1]=numlist[j+1],numlist[j]
            numlist[j+1], numlist[j] = numlist[j], numlist[j+1]
print(numlist)
    原文作者:杨辉三角问题
    原文地址: https://blog.csdn.net/qq_35840325/article/details/81990051
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞