Ad
  • Custom User Avatar

    Suppose the given list of numbers doesn't contain any positive numbers.

    There is nothing to sum up, but a return value still needs to be specified.

    The mathematical sum operator $\sum$ is defined to result in 0 if there is nothing to sum up, but not everyone knows that. Some definitions of a sum even have the sum of nothing be undefined.

  • Custom User Avatar

    I was really confused by the return 0. I was trying to work my code, that it would end with return zero. I realized by trying that it needs to be ignored. But why is it there in the first place?

  • Custom User Avatar

    So do I understand it correctly, that we also need to provide x, the list of names?