Skip to content

Switch case #7995

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

Merged
merged 13 commits into from
May 10, 2023
Prev Previous commit
Next Next commit
Apply suggestions from code review
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
  • Loading branch information
cclauss and CaedenPH authored Oct 30, 2022
commit c4b81c20e0716484c18329acadefd52ba840d0e1
10 changes: 5 additions & 5 deletions maths/remove_digit.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@ def remove_digit(num: int) -> int:
TypeError: only integers accepted as input
"""

if type(num) == int:
if isinstance(num, int):
num_str = str(abs(num))
num_transpositions = [
[char for char in num_str] for char in range(len(num_str))
]
for index in range(len(num_str)):
num_transpositions[index].pop(index)
return sorted(
[
int("".join([char for char in transposition]))
for transposition in num_transpositions
int("".join([char for char in transposition]))
for transposition in num_transpositions,
reverse=True
]
)[-1]
)[0]
else:
raise TypeError("only integers accepted as input")

Expand Down