当前位置:网站首页>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:
边栏推荐
- Installation and configuration of nodejs+npm
- 内网穿透-应用
- 2022年上半年各大厂Android面试题整理及答案解析(持续更新中......)
- [store mall project 01] environment preparation and testing
- thinkphp 常用技巧
- Flink jdbc connector 源码改造sink之 clickhouse多节点轮询写与性能分析
- Use of lombok annotation @RequiredArgsConstructor
- 有没有jdbc 链接优炫数据库文档及示例?
- C语言:学生管理系统(链表版)
- 无代码7月热讯 | 微软首推数字联络中心平台;全球黑客马拉松...
猜你喜欢
随机推荐
Flask框架初学-05-命令管理Manager及数据库的使用
this巩固训练,从两道执行题加深理解闭包与箭头函数中的this
如何用C语言代码实现商品管理系统开发
什么是SVN(Subversion)?
114. How to find the cause of Fiori Launchpad routing error by single-step debugging
boot issue
VR panorama shooting online exhibition hall, 3D panorama brings you an immersive experience
谁说程序员不懂浪漫,表白代码来啦~
2022 China Computing Power Conference released the excellent results of "Innovation Pioneer"
字符串的排列
FeatureNotFound( bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested:
nodejs+express实现数据库mysql的访问,并展示数据到页面上
Use of lombok annotation @RequiredArgsConstructor
Slipper - virtual point, shortest path
静态文件快速建站
Is there any jdbc link to Youxuan database documentation and examples?
OpenCV如何实现Sobel边缘检测
【Untitled】
LDO investigation
工程制图平面投影练习