Learn how to calculate the minimum and maximum of a given input using the min() and max() functions accordingly. These functions take (for now) an unlimited number of inputs so you can calculate the minimum or maximum of 2 or 12 arguments as long as you add each as its own input. In addition, if you need the first alphabetical name in a group of input, this would be helpful.
- [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.…Well 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.…Well, we can create a variable called playerOneScore…and say it's 10.…And then we'll create another…variable called playerTwoScore 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 player two…and so player two would be the winner.…You can do this with any number of numbers…and so you could do minimum of say, zero,…12, negative 19, and you could add…a bunch of other numbers here as long…as they're separated by those commas.…
- Working with logical and comparison operators
- Getting a list of numbers with the range() and list() functions
- Using mathematical functions such as round(), abs(), and pow()
- Calculating a given input's length
- Importing and using the math module
- Reading a user's command-line arguments
- Getting the current time
- Formatting dates and times with datetime
- Creating a timer
- Using urllib to get content from the Internet
- Using the JSON module to decode content
Skill Level Intermediate
Learning the Standard PHP Librarywith David Powers3h 24m Intermediate
1. Python: What's Built-In?
2. Python: Math
3. Python: Input/Output
4. Python: Date & Time, HTML Parsing, and HTTP
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.