From the course: Advanced Python: Working With Data

Unlock the full course today

Join today to access over 23,400 courses taught by industry experts.

Data utility functions

Data utility functions

- [Instructor] Now let's take a look at some of the useful utility functions that Python provides. Specifically the any, all and sum functions. And so here in chapter one, I'm going to open up the utility.py file. And once again, here are my sample code. I have a list of integer values already defined. The any function can be used to see if any value in a given sequence evaluates to a Boolean true value. And remember that for integers, any non-zero value evaluates to a true Boolean. The all function is similar except that it determines whether all of the values in a sequence are true. And then finally, the sum function will add up all the values in a sequence. Okay? So let's give each of these a try. I'm going to print out any and I'm just going to call it on the values array. And then I'll do the same thing. I'm just going to paste this down here and call all instead, right? And then I'll call sum on the values list.…

Contents