菜鸟教程 -- 学的不仅是技术,更是梦想!

Python 基础教程
(追記) (追記ここまで)

Python 练习实例73

Python 100例 Python 100例

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

程序分析:无。

实例(Python 2.0+)

#!/usr/bin/python# -*- coding: UTF-8 -*-if__name__ == '__main__': ptr = []foriinrange(5): num = int(raw_input('please input a number:\n'))ptr.append(num)printptrptr.reverse()printptr

以上实例输出结果为:

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例

AI 思考中...

点我分享笔记

  • 昵称 (必填)
  • 邮箱 (必填)
  • 引用地址

AltStyle によって変換されたページ (->オリジナル) /