Write a python function that checks if all the numbers in a list sum upto 1. Returns False otherwise
Topic: Write a python function that checks if all the numbers in a list sum upto 1. Returns False otherwise
Solution
def sum_upto_one(arr): arr_sum = sum(arr) try: assert float(arr_sum) == 1.0 return True except AssertionError: return False
List all Python Programs