欢迎您 本站地址:  
返回首页   返回编程教学   增广贤文  网站打包生成app  圈小猫  色彩敏感度测试  金史  爽口茶  蔬风解表茶  学习CMake 

Python 练习实例73

Python 100例 Python 100例

题目:反向输出一个链表。

程序分析:无。

实例(Python 2.0+)

#!/usr/bin/python # -*- coding: UTF-8 -*- if __name__ == '__main__': ptr = [] for i in range(5): num = int(raw_input('please input a number:\n')) ptr.append(num) print ptr ptr.reverse() print ptr

以上实例输出结果为:

please input a number:
6
please input a number:
5
please input a number:
3
please input a number:
4
please input a number:
8
[6, 5, 3, 4, 8]
[8, 4, 3, 5, 6]

Python 100例 Python 100例

小库提示

扫描下方二维码,访问手机版。