You can make use of the reversed function for this as:

>>> array=[0,10,20,40]
>>> for i in reversed(array):
... print(i)

Note that reversed(...) does not return a list. You can get a reversed list using list(reversed(array)).

list reverse的更多相关文章

  1. LeetCode 7. Reverse Integer

    Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321 Have you ...

  2. js sort() reverse()

    数组中存在的两个方法:sort()和reverse() 直接用sort(),如下: ,,,,,,,,,,,]; console.log(array.sort());ps:[0, 1, 2, 2, 29 ...

  3. [LeetCode] Reverse Vowels of a String 翻转字符串中的元音字母

    Write a function that takes a string as input and reverse only the vowels of a string. Example 1:Giv ...

  4. [LeetCode] Reverse String 翻转字符串

    Write a function that takes a string as input and returns the string reversed. Example: Given s = &q ...

  5. [LeetCode] Reverse Linked List 倒置链表

    Reverse a singly linked list. click to show more hints. Hint: A linked list can be reversed either i ...

  6. [LeetCode] Reverse Bits 翻转位

    Reverse bits of a given 32 bits unsigned integer. For example, given input 43261596 (represented in ...

  7. [LeetCode] Reverse Words in a String II 翻转字符串中的单词之二

    Given an input string, reverse the string word by word. A word is defined as a sequence of non-space ...

  8. [LeetCode] Reverse Words in a String 翻转字符串中的单词

    Given an input string, reverse the string word by word. For example, Given s = "the sky is blue ...

  9. [LeetCode] Evaluate Reverse Polish Notation 计算逆波兰表达式

    Evaluate the value of an arithmetic expression in Reverse Polish Notation. Valid operators are +, -, ...

  10. [LeetCode] Reverse Linked List II 倒置链表之二

    Reverse a linked list from position m to n. Do it in-place and in one-pass. For example:Given 1-> ...

随机推荐

  1. HZOI20190803 A,C题

    题目链接:https://www.cnblogs.com/Juve/articles/11295333.html A: 考场上只有70分... 发现几个性质:特殊性质1:在两条链上,看它是fib第几项 ...

  2. php报错:Notice: iconv(): Wrong charset, conversion from `GBK' to `UTF8' is not allowed

    代码写错了 $raw_data = iconv("GBK", "UTF8", $raw_data); 改成 $raw_data = iconv("GB ...

  3. 原生微信小程序的生命周期

    小程序的生命周期函数:onLaunch:function(){当启动小程序时触发小程序只会启动1次,一般为初次打开时一般只会触发一次},onShow:function(){当小程序从后台切入到前台时触 ...

  4. 编写一个函数isMerge,判断一个字符串str是否可以由其他两个字符串part1和part2“组合”而成

    编写一个函数isMerge,判断一个字符串str是否可以由其他两个字符串part1和part2“组合”而成.“组合 ”的规则如下: 1). str中的每个字母要么来自于part1,要么来自于part2 ...

  5. Ceisum官方教程1 -- 开始

    原文地址:https://cesium.com/docs/tutorials/getting-started/ 学会使用全球地形.影像.3d tile(模型切片).地理编码创建一个Cesium程序. ...

  6. BZOJ2982: combination Lucas模板

    2982: combination Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 734  Solved: 437[Submit][Status][Di ...

  7. Django项目:CRM(客户关系管理系统)--17--09PerfectCRM实现King_admin显示注册表的内容

    {#table_data_list.html#} {## ————————08PerfectCRM实现King_admin显示注册表的字段表头————————#} {% extends 'king_m ...

  8. []==![] 为什么等于true?

    最近碰到这样一个问题: []==![]  为什么等于true? 首先分析  !的优先级较==高,先运算==两侧的操作数: typeof []; //"object" typeof ...

  9. Lowest Common Ancestor (LCA)

    题目链接 In a rooted tree, the lowest common ancestor (or LCA for short) of two vertices u and v is defi ...

  10. hdu 1166 敌兵布阵(线段树区间求和)

    敌兵布阵 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submis ...