The Square Root Function in Python (Summary)
Knowing how to use sqrt()
is only half the battle. Understanding when to use it is the other. Now you’ve seen some of both, so go and apply your newfound knowledge about the Python square root function!
In this course, you’ve covered:
- A brief introduction to square roots
- The ins and outs of the Python square root function,
sqrt()
- A practical application of
sqrt()
using a real-world example
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 the previous lesson, I showed you how to use square roots to calculate the area of a roof. In this final lesson, I’ll summarize what you’ve learned.
00:09
A square is a number multiplied by itself. A square root is the result you’re looking for that when multiplied by itself gives you the squared number. Python provides two methods for calculating square roots in the math
module: sqrt()
and isqrt()
for integers.
00:28 Python also provides methods and operators for calculating powers, which you can use to calculate arbitrary n-th roots. Finally, I showed you how to use square roots in the Pythagorean theorem to calculate the length of the side of a triangle and use that to determine the area of a roof.
00:47 Thanks for your attention! I hope you found this course useful.
Christopher Trudeau RP Team on July 18, 2021
Old habits die hard? :)
Become a Member to join the conversation.
Patrick Dennis on July 17, 2021
Why do you force one of the operands in a division to be a float? Isn’t that redundant in Python 3.x?