Python 官方文档:入门教程 => 点击学习
#!/usr/bin/python # -*- coding:UTF-8 -*- def maopao(numbers): for j in xrange(len(numbers)-1,-1,-1):
#!/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()
--结束END--
本文标题: Python实现冒泡排序
本文链接: https://lsjlt.com/news/190911.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-03-01
2024-03-01
2024-03-01
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0