Python Basics: Numbers and Math (Summary)
In this video course, you learned all about working with numbers in Python. You saw that there are two basic types of numbers—–integers and floating-point numbers–—and that Python also has built-in support for complex numbers.
First, you saw how to do basic arithmetic with numbers using the +
, -
,
*
, /
, and %
operators. You learned how to write arithmetic expressions
and the best practices in PEP 8 for formatting arithmetic expressions
in your code.
Then you learned about floating-point numbers and how they may not always be 100 percent accurate. This limitation has nothing to do with Python. It’s a fact of modern-day computing related to the way that floating-point numbers are stored in a computer’s memory.
Next, you saw how to round numbers to a given decimal place with
round()
and learned that round()
rounds ties to even, which is different
from the way most people learned to round numbers in school. You
also saw numerous ways to format numbers for display.
Finally, you learned about Python’s built-in support for complex numbers.
Now it’s time to reinforce what you’ve learned. Hop over to Python Basics Exercises: Numbers and Math to practice your skills by solving coding challenges.
For more information on the concepts in this video course, check out:
- Numbers in Python
- How to Round Numbers in Python
- Representing Rational Numbers With Python Fractions
- Format String Syntax - Python documentation
- Simplify Complex Numbers With Python
To continue your Python learning journey, check out the Python Basics learning path.
Congratulations, you made it to the end of the course! What’s your #1 takeaway or favorite thing you learned? How are you going to put your newfound skills to use? Leave a comment in the discussion section and let us know.
00:00 In this lesson, you’ll get a quick recap of everything you learned in this course on numbers and math in Python. At first, you learned about the numeric types available in Python and how to create them using either numeric literals or their corresponding functions.
00:16 You saw that there are two basic types of numbers—integers and floating-point numbers—and that Python also has built-in support for complex numbers. You performed arithmetic operations on those numbers and built mathematical expressions involving them.
00:30 Then you learned more about floating-point numbers and how they may not always be 100 percent accurate. This limitation has nothing to do with Python. It’s a fact of modern-day computing related to the way floating-point numbers are stored in a computer’s memory. Next, you saw the most common functions and number methods that let you work with numbers in Python. Finally, you also saw numerous ways to format numbers for display.
00:56 Thanks so much for watching. If you’re wondering where to go next, then you’ll find all the links mentioned throughout this course in the slides that you can download, as well as the descriptions of the individual lessons.
01:08 Don’t hesitate to leave us a comment and tell us what you think of this course. You may also use the comment section below to ask questions if you have any.
01:16 All right, that’s it. Hope to see around at Real Python.
Become a Member to join the conversation.