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

边栏推荐
- 《The Google File System》新说
- 5.scrapy中间件&分布式爬虫
- FileNotFoundException: This file can not be opened as a file descriptor; it is probably compressed
- 实例040:逆序列表
- Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
- Deng Qinglin, Alibaba Cloud Technical Expert: Best Practices for Disaster Recovery across Availability Zones and Multiple Lives in Different Locations on the Cloud
- Electronics manufacturing enterprise deployment WMS what are the benefits of warehouse management system
- SAP SD模块前台操作
- 一个项目的整体测试流程有哪几个阶段?测试方法有哪些?
- Android interview questions and answer analysis of major factories in the first half of 2022 (continuously updated...)
猜你喜欢
![Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.](/img/10/87c0bedd49b5dce6fbcd28ac361145.png)
Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.

一篇文章看懂JS闭包,从执行上下文角度解析有趣的闭包

计算首屏时间

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

LeetCode third topic (the Longest Substring Without Repeating Characters) trilogy # 3: two optimization

Electronics manufacturing enterprise deployment WMS what are the benefits of warehouse management system

实例035:设置输出颜色

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

pygame 中的transform模块

nodejs+express实现数据库mysql的访问,并展示数据到页面上
随机推荐
nodejs install multi-version version switching
实例037:排序
C 学生管理系统_添加学生
ASP.NET 获取数据库的数据并写入到excel表格中
一个项目的整体测试流程有哪几个阶段?测试方法有哪些?
OpenCV如何实现Sobel边缘检测
螺旋矩阵_数组 | leecode刷题笔记
《The Google File System》新说
实例035:设置输出颜色
优秀的测试/开发程序员,是怎样修炼的?步步为营地去执行......
Use nodejs switch version (no need to uninstall and reinstall)
FileNotFoundException: This file can not be opened as a file descriptor; it is probably compressed
【无标题】
贪吃蛇游戏Bug解析及功能扩展
如何通过API接口从淘宝(或天猫店)复制宝贝到拼多多接口代码对接教程
typescript57 - Array generic interface
Continuing to invest in product research and development, Dingdong Maicai wins in supply chain investment
实例038:矩阵对角线之和
持续投入商品研发,叮咚买菜赢在了供应链投入上
nodejs安装及环境配置