zoukankan      html  css  js  c++  java
  • Python案例 005 (三位数字排序)



    # -*- coding:utf-8 -*-
    
    """
    enter 3  unit  ,and sort them
    
    """
    L = []
    for x  in range(3):
        L.append(int(raw_input("enter one unit data:
    ")))
    L.sort()
    L.sort(reverse=True)
    print L
    
    # try with  bubble sort
    
    bubbleList = [12,123,45,78,43,21,99,78,45,34,22,26]
    bubbleLen = len(bubbleList)
    for i  in range(1 ,bubbleLen):
        for j in range(1,bubbleLen - i+1):
            if bubbleList[j-1] > bubbleList[j] :
                bubbleList[j - 1] , bubbleList[j] =bubbleList[j] , bubbleList[j-1]
            print bubbleList
    
    print bubbleList


  • 相关阅读:
    utils04_搭建私有Git服务器
    utils03_clone远程仓库
    java 22
    java 22
    java 22
    java 22
    java 22
    java 22
    java 22
    java 22
  • 原文地址:https://www.cnblogs.com/TendToBigData/p/10501227.html
Copyright © 2011-2022 走看看