-
-
Notifications
You must be signed in to change notification settings - Fork 46.8k
Added Exponent Finding program #2236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Hey @Utsav1999, TravisCI finished with status TravisBuddy Request Identifier: 594dbd40-ceb9-11ea-84f0-41e93e5606ac |
The command "flake8 --ignore=E203,W503 --max-complexity=25 --max-line-length=88 --statistics --count ." failed and exited with 1 during . How to resolve this? |
The issues are listed. Go to details then The build link and scroll down. Looks like formatting issues mostly. |
I can help you to pass these checks but i don't know how to help and edit the code in this PR? @Utsav1999 |
Autofix with |
maths/exponent_recursion.py
Outdated
o/p --> | ||
2 to the power of 0: 1 | ||
''' | ||
def powerCalculation(n: int, p: int)->int: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def powerCalculation(n: int, p: int)->int: | |
def power(base: int, exponent: int)->int: | |
""" | |
>>> all(power(base, exponent) == pow(base, exponent) | |
... for base in range(-10, 10) for exponent in range(10)) | |
True | |
""" | |
return base * power(base, exponent - 1) if exponent > 0 else 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does not properly handle negative exponents.
Co-authored-by: Christian Clauss <cclauss@me.com>
Hey @Utsav1999, TravisCI finished with status TravisBuddy Request Identifier: e07ea170-cf50-11ea-9502-ed86ad10d0d8 |
Describe your change:
This Python recursion program is for finding exponent.
Checklist:
Fixes: #{$ISSUE_NO}
.