In this video, Kathryn shows you how to import the math module, and as how to use it to calculate cosine and sine in Python, as well as ceiling and floor. Then, she demonstrates some of the constants available in this module, such as pi and e.
- [Narrator] Modules are built into Python,…but we must import each module we want to use.…By built in, we mean that we don't have to download…anything extra from the Internet to use it.…And so, to import the math module here,…we'll go import math.…Now, to use the math module,…we just have to go math dot…and we get access to all of these methods.…Depending on what IDE you're using,…you might not get all of these shown up in your editor…like I do,…but they all still exist,…and you can look them up in the documentation.…In this video, we'll be going over…some of the most important ones.…
And to start off, we'll talk about the constants…that are built in to the math module.…One constant is pi, so you can just do math dot pi…and you have access to pi.…And so we'll just go ahead and print it out here…so we can see it in our console.…And here it prints out pi.…Another constant we can print out is e.…And so we can go print math dot e…accessing that constant,…and there it is again printed in the console.…Now, there are some new constants built into Python 3.5.…
- 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.