Gauss (ye, that Guass) came up with the equation sum = ( n / 2)(first number + last number), where n is the count of numbers, to describe the sum of consecutive numbers in a range. We can use that in this problem.
Missing number = carls sum - sum of array.
def find_missing_number(nums):
sum = 0
for num in nums:
sum += num
carl_sum = (len(nums) / 2) * (1 + len(nums))
return carl_sum - sum