diff --git a/beginner/sum_of_all_numbers_presleywong.py b/beginner/sum_of_all_numbers_presleywong.py new file mode 100644 index 0000000..727255b --- /dev/null +++ b/beginner/sum_of_all_numbers_presleywong.py @@ -0,0 +1,13 @@ +def sum_all(input_list): + if type(input_list) is not list: + return + + total = 0 + input_list.sort() + start = input_list[0] + end = input_list[-1]+1 + + for n in range(start, end): + total += n + + return total