-
-
Notifications
You must be signed in to change notification settings - Fork 46.5k
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
Add typing to binary_exp_mod.py #9469
Conversation
maths/binary_exp_mod.py
Outdated
@@ -1,4 +1,4 @@ | |||
def bin_exp_mod(a, n, b): | |||
def bin_exp_mod(a: int, n: float, b: 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 bin_exp_mod(a: int, n: float, b: int) -> int: | |
def bin_exp_mod(a: int, n: int, b: int) -> int: |
n
here is actually supposed to be an integer, not a float
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.
right that was my first change too, but linter fails on that: 606d844
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.
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.
I believe that might be due to the float division /
on line 16. Could you try changing that to integer division //
?
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.
sure
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.
@tianyizheng02 thanks this works, also TIL :)
updated similar change on other diff too
* Add typing to binary_exp_mod.py * Update binary_exp_mod.py * review changes
Describe your change:
Checklist: