Ad
Arithmetic
Mathematics
Algorithms
Logic
Numbers
Code
Diff
  • def sum_last_two_items(ls):
        return sum(ls[-2:])
    • def sum_last_two_items(ls):
    • return ls[-1]+ls[-2] if len(ls)>1 else ls[0]
    • return sum(ls[-2:])