-
- Notifications
You must be signed in to change notification settings - Fork 703
Add solution for Challenge 18 by forever-free1 #735
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 forever-free1 #735
Conversation
WalkthroughA new Go solution file is added to Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes
Possibly related PRs
Pre-merge checks❌ Failed checks (1 warning)
✅ Passed checks (2 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 (2)
challenge-18/submissions/forever-free1/solution-template.go (2)
20-23: Add documentation comment and improve formatting.The function is missing a documentation comment (unlike
FahrenheitToCelsius). Also, consider whether hardcoding the rounding to 2 decimal places is necessary, since themainfunction already formats output with%.2f.Apply this diff to add documentation and improve formatting:
+// CelsiusToFahrenheit converts a temperature from Celsius to Fahrenheit +// Formula: F = C × 9/5 + 32 func CelsiusToFahrenheit(celsius float64) float64 { - f:= celsius*9/5 + 32 - return Round(f,2) +f := celsius*9/5 + 32 +return Round(f, 2) }Alternatively, consider returning the unrounded value and letting callers control precision:
+// CelsiusToFahrenheit converts a temperature from Celsius to Fahrenheit +// Formula: F = C × 9/5 + 32 func CelsiusToFahrenheit(celsius float64) float64 { - f:= celsius*9/5 + 32 - return Round(f,2) +return celsius*9/5 + 32 }
27-30: Improve formatting and consider precision flexibility.Minor formatting improvements needed for Go conventions. Also, similar to
CelsiusToFahrenheit, consider whether hardcoding rounding to 2 decimal places is necessary.Apply this diff to improve formatting:
func FahrenheitToCelsius(fahrenheit float64) float64 { - c := (fahrenheit-32) * 5/9 -return Round(c,2) +c := (fahrenheit - 32) * 5/9 +return Round(c, 2) }Or, for maximum flexibility, return the unrounded value:
func FahrenheitToCelsius(fahrenheit float64) float64 { - c := (fahrenheit-32) * 5/9 -return Round(c,2) +return (fahrenheit - 32) * 5/9 }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
challenge-18/submissions/forever-free1/solution-template.go(1 hunks)
🔇 Additional comments (1)
challenge-18/submissions/forever-free1/solution-template.go (1)
32-36: LGTM!The
Roundfunction is well-documented and correctly implemented using standard library functions.
Challenge 18 Solution
Submitted by: @forever-free1
Challenge: Challenge 18
Description
This PR contains my solution for Challenge 18.
Changes
challenge-18/submissions/forever-free1/solution-template.goTesting
Thank you for reviewing my submission! 🚀