当前位置:网站首页>Example 037: Sorting
Example 037: Sorting
2022-08-04 01:40:00 【lazily】
Title: Sort 10 numbers.
Program Analysis: Same as Example 005.
Code:
Method one:
raw=[]for i in range(10):x=int(input('int%d: '%(i)))raw.append(x)for i in range(len(raw)):for j in range(i,len(raw)):if raw[i]>raw[j]:raw[i],raw[j]=raw[j],raw[i]print(raw)"""* @Author: xiaofang* @Description:Problems encountered during study and no one answered?The editor created a Python learning and communication QQ group, just scan the QR code of the QQ group at the end of the articleLooking for like-minded friends to help each other, there are also good video learning tutorials and PDF e-books in the group!"""Method Two:
raw = []for i in range(10):x = int(input('int%d: ' % (i)))raw.append(x)print(sorted(raw))Results:

边栏推荐
猜你喜欢

Flink jdbc connector 源码改造sink之 clickhouse多节点轮询写与性能分析

螺旋矩阵_数组 | leecode刷题笔记

SAP SD模块前台操作

持续投入商品研发,叮咚买菜赢在了供应链投入上

Android interview questions and answer analysis of major factories in the first half of 2022 (continuously updated...)

实例040:逆序列表

计算首屏时间

5. Scrapy middleware & distributed crawler

持续投入商品研发,叮咚买菜赢在了供应链投入上

工程制图复习题(带答案)
随机推荐
贪吃蛇游戏Bug解析及功能扩展
TensoFlow学习记录(二):基础操作
持续投入商品研发,叮咚买菜赢在了供应链投入上
Continuing to invest in product research and development, Dingdong Maicai wins in supply chain investment
可变字符串
静态/动态代理模式
this巩固训练,从两道执行题加深理解闭包与箭头函数中的this
多渠道打包
有没有jdbc 链接优炫数据库文档及示例?
Variable string
OpenCV如何实现Sobel边缘检测
js中常用的几种遍历处理数据的方法梳理
实例035:设置输出颜色
nodejs+express realizes the access to the database mysql and displays the data on the page
Flask框架初学-05-命令管理Manager及数据库的使用
贴纸拼词 —— 记忆化搜索 / 状压DP
html select标签赋值数据库查询结果
.NET Static Code Weaving - Rougamo Release 1.1.0
esp32 releases robot battery voltage to ros2 (micro-ros+CoCube)
FileNotFoundException: This file can not be opened as a file descriptor; it is probably compressed