mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 09:41:36 +00:00
Type correction for the output of math.sqrt()
Both in Python 2.7.10 and Python 3.6.5, math.sqrt() returns a float and not int. It seems like a tiny thing but sometimes may lead up to bigger confusions. For example: https://stackoverflow.com/questions/54474037/why-are-the-following-codes-giving-me-different-output-square-root-big-numbers/54475501#54475501
This commit is contained in:
parent
63abe3316c
commit
fa9f9fd563
@ -661,7 +661,7 @@ i.age # => raises an AttributeError
|
||||
# You can import modules
|
||||
import math
|
||||
|
||||
print math.sqrt(16) # => 4
|
||||
print math.sqrt(16) # => 4.0
|
||||
|
||||
# You can get specific functions from a module
|
||||
from math import ceil, floor
|
||||
|
Loading…
Reference in New Issue
Block a user