-
Notifications
You must be signed in to change notification settings - Fork 725
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
solution #672
base: master
Are you sure you want to change the base?
solution #672
Conversation
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.
Thank you for your hard work on this Pull Request! There are a few critical issues that need to be addressed before we can approve it. The most important one is the incorrect update of the customer's location after the trip home, which affects the logic of the trip cost calculation. Additionally, ensure that the total cost and printed values are rounded to two decimal places as required. Lastly, consider using the current date and time for the receipt to enhance its realism. Once these issues are resolved, your code will be in great shape! Keep up the great work! 😊
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
🔄 Fix the issues, commit the changes, and then re-request my review using the Re-request review
button in the Reviewers tab.
app/main.py
Outdated
customer.money -= trip_home_cost | ||
customer.move_to(customer.location) |
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.
The customer's location is incorrectly updated to their current location after the trip home. You should update it to their original home location instead. This is a critical issue as it affects the logic of the trip cost calculation.
app/main.py
Outdated
print(f"{customer.name}'s trip to " | ||
f"the {shop.name} costs {total_cost}") |
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.
Ensure that the printed total cost is rounded to two decimal places as required by the task description .
app/shop.py
Outdated
specific_time = datetime(2021, 4, 1, 12, 33, 41) | ||
receipt = [ | ||
f"Date: {specific_time.strftime("%m/%d/%Y %H:%M:%S")}", |
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.
The date in the receipt is hardcoded to a specific time. Consider using the current date and time to make the receipt more dynamic and realistic.
|
||
total_cost = int(total_cost) if total_cost.is_integer() \ | ||
else round(total_cost, 1) | ||
receipt.append(f"Total cost is {total_cost} dollars") |
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.
Ensure that the total cost is rounded to two decimal places as required by the task description.
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.
Great job on implementing the solution! 🎉 Your code meets most of the task requirements and constraints, and it's structured well with the use of classes and modules. Here are some points to consider for improvement:
-
Customer's Location Update: Ensure that the customer's location is correctly updated after the trip home. Store the original location before moving to the shop and use it to update the customer's location after the trip.
-
Rounding Logic: Make sure that all financial calculations, including
total_cost
andformatted_cost
, are rounded to two decimal places. This will ensure consistency with the task requirements for financial calculations. -
Output Consistency: Ensure that the customer's remaining money and total cost are rounded to two decimal places when printed. This will help maintain consistency in the output format.
Your code is on the right track, and these adjustments will help you refine it further. Keep up the good work, and make sure to address these points in future projects to enhance your coding skills. Happy coding! 😊
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
original_location = customer.location | ||
customer.money -= trip_home_cost | ||
customer.move_to(original_location) |
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.
The customer's location is not correctly updated after the trip home. You should store the original location before moving to the shop and use it to update the customer's location after the trip home.
print(f"{customer.name}'s trip to " | ||
f"the {shop.name} costs {round(total_cost, 2)}") |
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.
Ensure that the total cost is rounded to two decimal places when printed. This is important for maintaining consistency in the output format.
customer.move_to(original_location) | ||
|
||
print(f"{customer.name} rides home") | ||
print(f"{customer.name} now has {customer.money} dollars\n") |
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.
Ensure that the customer's remaining money is rounded to two decimal places when printed. This will help maintain consistency in the output format.
formatted_cost = int(cost) \ | ||
if cost.is_integer() \ | ||
else round(cost, 1) |
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.
The rounding logic for formatted_cost
should ensure that costs are rounded to two decimal places, not one. This will maintain consistency with the task requirements for financial calculations.
total_cost = int(total_cost) if total_cost.is_integer() \ | ||
else round(total_cost, 1) |
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.
The rounding logic for total_cost
should ensure that costs are rounded to two decimal places, not one. This will maintain consistency with the task requirements for financial calculations.
No description provided.