-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
[Introduction] Wrong output presented for __doc__attribute of number_to_the_power_of #2833
Copy link
Copy link
Closed
Description
Hi,
I was reading the Introduction article about Python (link) and found a code snippet that I tested in my IDLE Shell (Python 3.8.10).
Markdown permalink:
def number_to_the_power_of(number_one, number_two):
"""Raise a number to an arbitrary power.
:param number_one: int the base number.
:param number_two: int the power to raise the base number to.
:return: int - number raised to power of second number
Takes number_one and raises it to the power of number_two, returning the result.
"""
return number_one ** number_two
And then:
print(number_to_the_power_of.__doc__)
What I get is:
Raise a number to an arbitrary power.
:param number_one: int the base number.
:param number_two: int the power to raise the base number to.
:return: int - number raised to power of second number
Takes number_one and raises it to the power of number_two, returning the result.
But in lines 182-184 there is a different output (link):
Returns float or int.
Takes number_one and raises it to the power of number_two, returning the result.
Is it correct?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels