課程
/后端開發
/Python
/初識Python
從高到底排序,是先用sort(),然后再用reverse()嗎
下面的代碼:
L=[“tom,98”,“tony,100”,“peter,65”,“smith,70”]
L.sort()
L.reverse()
print L
2017-02-28
源自:初識Python 4-1
正在回答
L?=?['Adam',?95.5,?'Lisa',?85,?'Bart',?59] print?L
此課程是基礎內容,自己排序輸出即可,還沒用用到你說的方法。
#!/usr/bin/env python# -*- coding: utf-8 -*-"""__title__ = ''__author__ = 'fy'__mtime__ = '2017/2/28'# 歡迎進入我的主頁:https://www.zhihu.com/people/lian-fei-11/activities."""L=['tony',100,'tom',98,'smith',70,'peter',65]print L
L.sort(reverse=True)
舉報
學python入門視頻教程,讓你快速入門并能編寫簡單的Python程序
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯系客服咨詢優惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
2017-02-28
此課程是基礎內容,自己排序輸出即可,還沒用用到你說的方法。
2017-02-28
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
__title__ = ''
__author__ = 'fy'
__mtime__ = '2017/2/28'
# 歡迎進入我的主頁:https://www.zhihu.com/people/lian-fei-11/activities.
"""
L=['tony',100,'tom',98,'smith',70,'peter',65]
print L
2017-02-28
L.sort(reverse=True)