-
-
Notifications
You must be signed in to change notification settings - Fork 713
Add solution for Challenge 18 by k4sper1love #758
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 solution for Challenge 18 by k4sper1love #758
Conversation
WalkthroughAdds a new Go solution file containing three exported functions: Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes
Possibly related PRs
Pre-merge checks✅ Passed checks (3 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
challenge-18/submissions/k4sper1love/solution-template.go (1)
33-37: Consider optional refinements for the Round helper.The rounding logic is correct and works well for the temperature conversion use cases. Two optional suggestions:
Input validation: The function doesn't handle edge cases like negative
decimalsvalues, which would produce unexpected results. For a more robust implementation, consider adding validation.Function visibility: Since
Roundis exported (capitalized), it becomes part of the public API. If it's only intended as a helper for the conversion functions, consider making it private (lowercaseround).Both suggestions are optional refinements that don't affect the correctness of the current implementation.
If you'd like to add validation, here's an example:
// Round rounds a float64 value to the specified number of decimal places func Round(value float64, decimals int) float64 { + if decimals < 0 { + decimals = 0 + } precision := math.Pow10(decimals) return math.Round(value*precision) / precision }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
challenge-18/submissions/k4sper1love/solution-template.go(1 hunks)
🔇 Additional comments (3)
challenge-18/submissions/k4sper1love/solution-template.go (3)
8-17: LGTM! Clean demonstration of the conversion functions.The example usage clearly demonstrates both conversion functions with proper formatting.
19-24: LGTM! Correct temperature conversion formula.The Celsius to Fahrenheit conversion is implemented correctly using the standard formula F = C × 9/5 + 32, with appropriate rounding.
26-31: LGTM! Correct temperature conversion formula.The Fahrenheit to Celsius conversion is implemented correctly using the standard formula C = (F - 32) × 5/9, with appropriate rounding.
Challenge 18 Solution
Submitted by: @k4sper1love
Challenge: Challenge 18
Description
This PR contains my solution for Challenge 18.
Changes
challenge-18/submissions/k4sper1love/solution-template.goTesting
Thank you for reviewing my submission! 🚀