Skip to content

Commit

Permalink
Update binary_exponentiation.py (TheAlgorithms#10253)
Browse files Browse the repository at this point in the history
* Update binary_exponentiation.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
2 people authored and sedatguzelsemme committed Sep 15, 2024
1 parent 79e540a commit 51e7ea8
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions maths/binary_exponentiation.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@


def binary_exponentiation(a: int, n: int) -> int:
"""
>>> binary_exponentiation(3, 5)
243
>>> binary_exponentiation(10, 3)
1000
"""
if n == 0:
return 1

Expand All @@ -17,6 +23,10 @@ def binary_exponentiation(a: int, n: int) -> int:


if __name__ == "__main__":
import doctest

doctest.testmod()

try:
BASE = int(input("Enter Base : ").strip())
POWER = int(input("Enter Power : ").strip())
Expand Down

0 comments on commit 51e7ea8

Please sign in to comment.