码迷,mamicode.com
首页 > 编程语言 > 详细

python基本操作示例

时间:2019-11-20 21:44:43      阅读:70      评论:0      收藏:0      [点我收藏+]

标签:排序   多行注释   基本操作   ide   isp   NPU   col   input   splay   

列表

技术图片
 1 n=int(input())
 2 l=[]
 3 for i in range(n):
 4     l.append(int(input()))
 5 print("原列表:",l)
 6 l.sort()
 7 print("排序后:",l)
 8 l.reverse()
 9 print("反转后",l)
10 
11 
12 3
13 1
14 4
15 2
16 原列表: [1, 4, 2]
17 排序后: [1, 2, 4]
18 反转后 [4, 2, 1]
l.sort() l.reverse()

 

 

 

快捷键:

Ctrl+/          多行注释

Tab             多行向后

Shift+Tab    多行向前

python基本操作示例

标签:排序   多行注释   基本操作   ide   isp   NPU   col   input   splay   

原文地址:https://www.cnblogs.com/liiiiiiiiiiinnnnnnnn/p/11900742.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!