【发布时间】:2014-03-19 01:52:49
【问题描述】:
我有一个列表,想比较最后一个值是否大于过去的 10 个值,但是,我知道有一个更简单的方法来解决这个问题,然后是下面的代码:
list = [1,2,3,4,5,6,7,8,9,10]
if list[-1] > list[-2] and list[-1] > list[-3] and list[-1] > list[-4]: (etc)
print "It's bigger"
任何建议将不胜感激!
【问题讨论】:
标签: python list compare elements