Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add GCD and LCM utility functions to Python snippets #25

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

Closed
SteliosGee wants to merge 1 commit into quicksnip-dev:main from SteliosGee:main

Conversation

Copy link
Contributor

@SteliosGee SteliosGee commented Dec 30, 2024

I added 2 code snippets, one for finding the greatest common divisor (GCD) of two numbers using the Euclidean algorithm and a second one for finding the least common multiple (LCM) of two numbers.

Copy link

netlify bot commented Dec 30, 2024
edited
Loading

Deploy Preview for quicksnip ready!

Name Link
🔨 Latest commit 4631a91
🔍 Latest deploy log https://app.netlify.com/sites/quicksnip/deploys/67729ab2b064e50008cb73b3
😎 Deploy Preview https://deploy-preview-25--quicksnip.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Collaborator

@Mathys-Gasnier Mathys-Gasnier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GDC is already available as a function of the math package in python, so I think it should this function instead of calculating the result itself.
For the LCM you can use x * y // gcd(x, y) which uses the gdc to calculate the lcm, it's a lot simpler.

Those a suggestion, feel free to ignore them if they dont fit what you want the snippets to look like

technoph1le reacted with thumbs up emoji
Copy link
Contributor Author

GDC is already available as a function of the math package in python, so I think it should this function instead of calculating the result itself. For the LCM you can use x * y // gcd(x, y) which uses the gdc to calculate the lcm, it's a lot simpler.

Those a suggestion, feel free to ignore them if they dont fit what you want the snippets to look like

You are right, i totally forgot. Instead i made some string manipulation snippets I will show on a new pull request.

technoph1le reacted with thumbs up emoji

Copy link
Contributor Author

Already built-in functions from the math packages

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@Mathys-Gasnier Mathys-Gasnier Mathys-Gasnier left review comments

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /