From the course: Learning the Python 3 Standard Library

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Min and max

Min and max

- [Instructor] So what do we know about minimum and maximum? Well, minimum is usually the least item or the lowest item and maximum is usually the greatest item. So say you're given zero, five, eight while your lowest item would be zero and your greatest eight. Well, we can do this exact thing with Python. So let's say we want to calculate the winner of a given game. While we can create a variable called playerOneScore, and say it's 10, and then, we'll create another variable called playerTwo Score and set that equal to four. Now to calculate which player actually won, say this is golf, and so, we want the minimum score. We could do print minimum playerOneScore and then playerTwoScore. And when we run this, we see the least score and the minimum score is four. And that is associated with playerTwo. And so, playerTwo would be the winner. You can do this with any number of numbers, and so, you could do minimum of say…

Contents