当前位置:网站首页>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:

边栏推荐
- Vant3 - click on the corresponding name name to jump to the next page corresponding to the location of the name of the TAB bar
- 实例037:排序
- 【无标题】
- 哎,又跟HR在小群吵了一架!
- OpenCV如何实现Sobel边缘检测
- HBuilderX的下载安装和创建/运行项目
- C 学生管理系统 显示链表信息、删除链表
- html select tag assignment database query result
- 如何通过API接口从淘宝(或天猫店)复制宝贝到拼多多接口代码对接教程
- splice随机添加和删除的写法
猜你喜欢

Quickly build a website with static files

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

Analysis of usage scenarios of mutex, read-write lock, spin lock, and atomic operation instructions xaddl and cmpxchg

字符串变形

MongoDB数据接入实践

appium软件自动化测试框架

this巩固训练,从两道执行题加深理解闭包与箭头函数中的this

esp32发布机器人电池电压到ros2(micro-ros+CoCube)

Parquet encoding

循环绕过问题
随机推荐
Deng Qinglin, Alibaba Cloud Technical Expert: Best Practices for Disaster Recovery across Availability Zones and Multiple Lives in Different Locations on the Cloud
计算首屏时间
工程制图复习题(带答案)
Sticker Spelling - Memory Search / Shape Pressure DP
lombok注解@RequiredArgsConstructor的使用
Thinkphp commonly used techniques
SAP SD模块前台操作
敏捷交付的工程效能治理
LDO investigation
数组_滑动窗口 | leecode刷题笔记
C程序编译和预定义详解
VR panorama shooting online exhibition hall, 3D panorama brings you an immersive experience
ThreadLocal
Demand analysis of MES management system in electronic assembly industry
5.scrapy中间件&分布式爬虫
Multithreading JUC Learning Chapter 1 Steps to Create Multithreading
JS 从零教你手写节流throttle
Continuing to invest in product research and development, Dingdong Maicai wins in supply chain investment
pygame 中的transform模块
一个注解替换synchronized关键字:分布式场景下实现方法加锁