#!/usr/bin/python
# -*- coding:UTF-8 -*-
def maopao(numbers):
for j in xrange(len(numbers)-1,-1,-1):
for i in xrange(j):
if(numbers[i] > numbers[i+1]):
numbers[i],numbers[i+1] = numbers[i+1],numbers[i]
print numbers
def main():
number = raw_input("enter some num seperate with split").split(",")
maopao(number)
if __name__ == '__main__':
main()
本文转sinojelly51CTO博客,原文链接:http://blog.51cto.com/pnig0s1992/357888,如需转载请自行联系原作者