In this video, Kathryn demonstrates more of the functions that are available through the math module, including factorials, square roots, and greatest common denominator. She also shows you how to convert degrees to radians and vice versa.
- [Voiceover] Let's dive deeper into the math module.…First we have to import math because we have…to have our module we're working with,…and we are going to start off by looking…at the factorial function.…To use it, you just do math.factorial,…and it'll get the factorial of any number you want.…And so to start off, we'll go 3,…and then we'll go ahead…and print this whole thing out.…And so this will just give us the factorial of 3,…and that would be 3 x 2 x 1 which will…give us 6 in the output.…
Another function that's just built into the math module…ready for us to` use is square root.…We'll go print math.the square root and so sqrt,…and then any number you want to get the square root of.…Here we'll just do 64 and the square root of 64 is 8,…and that's what we get in the output.…Another thing Python can do is help us find the greatest…common denominator between two numbers.…The name of the method we use is GCD,…and GCD stands for "greatest common denominator".…
And this method is really useful for reducing fractions.…
- 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?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
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.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.