-
-
Notifications
You must be signed in to change notification settings - Fork 47.1k
Created harshad_numbers.py #9023
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
Changes from 1 commit
c319119
e10bc54
deec6d4
fcb5639
44eb286
ad09b82
3d00dad
4d1a89c
21a703d
1584436
7b9809c
03d0296
2974289
6ebaf25
04f1e2b
6b0243c
385c294
edf0036
8dbfa37
d4d9c7c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
Fixed depreciated Tuple and List usage
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,6 @@ | |
Reference: https://en.wikipedia.org/wiki/Harshad_number | ||
""" | ||
|
||
from typing import Tuple, List | ||
|
||
|
||
def int_to_base(number: int, base_of_interest: int) -> str: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As there is no test file in this pull request nor any test function or class in the file There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As there is no test file in this pull request nor any test function or class in the file
davidekong marked this conversation as resolved.
Show resolved
Hide resolved
davidekong marked this conversation as resolved.
Show resolved
Hide resolved
|
||
digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" | ||
|
@@ -55,7 +53,7 @@ def sum_of_digits(num: int, base_of_interest: int) -> str: | |
return res | ||
|
||
|
||
def all_harshad_numbers(num: int, base_of_interest: int) -> Tuple[int, List[str]]: | ||
def all_harshad_numbers(num: int, base_of_interest: int) -> tuple[int, list[str]]: | ||
davidekong marked this conversation as resolved.
Show resolved
Hide resolved
|
||
""" | ||
Finds all Harshad numbers smaller than num in base 'base_of_interest'. | ||
Where 'base_of_interest' ranges from 2 to 36. | ||
|
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.
As there is no test file in this pull request nor any test function or class in the file
maths/harshad_numbers.py
, please provide doctest for the functionint_to_base