-
Notifications
You must be signed in to change notification settings - Fork 12.4k
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
Python Contribution #2492
Comments
The problem has occurred because the calculate_total function is not properly handling the decimal values. You need to insert the Decimal class to avoid these errors.
|
Hello, I’m Zilola. I’ve been looking into the issue regarding the Problem: As you mentioned, it seems that the function is not properly handling decimal values when calculating the total. Suggestion: I believe the issue can be resolved by using the If you need further assistance, I am here to help. Thank you! |
Hello, I’m Zilola. I need help with my code because it has an error. I have a simple chatbot implementation, but I am facing an issue. Here’s the code: class ChatBot:
def __init__(self, name):
self.name = name
def greet(self):
return "Hello! I'm " + self.name
def respond(self, message):
if message.lower() == "how are you?":
return "I'm fine, thank you!"
elif message.lower() == "what's your name?":
return "My name is " + self.name
else:
return "Sorry, I don't understand."
bot = ChatBot(None)
print(bot.greet())
print(bot.respond("How are you?")) |
you are getting issue because of None, you can solve it by using a default name. Change self.name as given below. I hope it helps. class ChatBot:
Create a Chatbot instance with None as the namebot = ChatBot(None) |
Incorrect Output in calculate_total Function
Description:I have encountered an issue in the calculate_total() function in the billing.py file. When I provide input with a list of prices, the total calculated is incorrect. The function does not seem to handle decimal values correctly.
The text was updated successfully, but these errors were encountered: