Added Exponent Finding program#2236
Added Exponent Finding program#2236Utsav1999 wants to merge 2 commits intoTheAlgorithms:masterfrom Utsav1999:utsav-python-exponent
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.
| 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 |
cclauss
left a comment
There was a problem hiding this comment.
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}.