how to get first and last element from generator comprehension in o(1) time like list?

前端 未结 0 1770
灰色年华
灰色年华 2020-12-16 16:07

how can we use generator to get me the first and last value of values present in generator comprehension: ex: if we would use list : l=[1,2,3,4] and we want first and last

相关标签:
回答
  • 消灭零回复
提交回复
热议问题