-
-
Notifications
You must be signed in to change notification settings - Fork 713
Add solution for Challenge 18 by yz4230 #765
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
base: main
Are you sure you want to change the base?
Conversation
WalkthroughA new Go program is added in 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 (1)
challenge-18/submissions/yz4230/solution-template.go (1)
19-31: LGTM! Temperature conversion formulas are correct.Both conversion functions implement the correct formulas and properly round to 2 decimal places. The logic is sound and follows the requirements.
Optional: Simplify parentheses on line 23.
The extra parentheses around
celsius*9/5+32are not necessary and could be removed for cleaner code:- return Round((celsius*9/5+32), 2) + return Round(celsius*9/5+32, 2)Note: Line 30's parentheses are correct as-is, since
(fahrenheit-32)must be evaluated before multiplication.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
challenge-18/submissions/yz4230/solution-template.go(1 hunks)
🔇 Additional comments (3)
challenge-18/submissions/yz4230/solution-template.go (3)
1-6: LGTM! Appropriate imports for temperature conversion utilities.The package declaration and imports are correct. Using standard library packages
fmtandmathis appropriate for this temperature conversion implementation.
8-17: LGTM! Main function demonstrates the conversions clearly.The example usage properly demonstrates both temperature conversion functions with appropriate formatting.
33-37: LGTM! Rounding implementation is correct.The
Roundfunction uses a standard approach: scale up by 10^decimals, applymath.Round, then scale back down. This correctly rounds float values to the specified number of decimal places.
Challenge 18 Solution
Submitted by: @yz4230
Challenge: Challenge 18
Description
This PR contains my solution for Challenge 18.
Changes
challenge-18/submissions/yz4230/solution-template.goTesting
Thank you for reviewing my submission! 🚀