Skip to content

Latest commit

 

History

History
22 lines (19 loc) · 436 Bytes

File metadata and controls

22 lines (19 loc) · 436 Bytes

What Did I Learn?

In this challenge I learned:

  1. Loop that repeats until only one element is left on the list
n = len(nums)
while n > 1:
    n -= 1
  1. Creating a new list with the sum of the elements of the previous one and updating values
ans = []
while n > 1:
    for i in range(len(nums) - 1):
        ans.append((nums[i] + nums[i+1]) % 10)
    nums = ans
    ans = []
    n -= 1
return nums[0]