Ask your own question, for FREE!
Computer Science 13 Online
toga:

Here is the code for a friendly AI bot that I made. How does the code look? Do you have any tips for me?

toga:

curriful:

The code looks great! I personally don't see any problems with it.

Midnight97:

It looks fine, I do not see anything wrong with it

toga:

do you have any tips

Midnight97:

@toga wrote:
do you have any tips
I'm not the best coder but I don't

ihatelifeFS420:

looks good

Tsukage:

Its good, you should slide the tutorial though.

5starpeaches:

...

OLIVER69:

There's nothing wrong with this code, It's very well put together and it's a pretty good code, but the AI bot could have more responses you know? Maybe have it sound more friendly. You could have the bot say after someone finishes asking the AI bot finishes explaining the bot could say, "Well please have a nice day and please reach out if you .e help with anything else." It's just a suggestion though, you don't have to take it. I hope I could help a bit.

Aratox:

This bot should have a few more responses, other than just to the prompts "hi" and "thanks". If possible, you should try using the API of an AI (this is just a suggestion though, and may not yield the best possible results, therefore making your AI somewhat harmful).

BBYGIRL:

what type of codng are u doing

Aratox:

@bbygirl wrote:
what type of codng are u doing
The bot that toga created is written in Python.

toga:

@locomoco62 wrote:
hello everyone!!!
this is a type of spam I am not gonna report you if delete this reply

Aratox:

Take this to DMs lmao

toga:

@locomoco62 wrote:
spam? im just tryna make friends ;-;
fan and DM people I just don't want you to get in trouble

Extrinix:

I wouldn’t consider this as “AI”, but it definitely is an input-based bot response. Still good either way though. As others said, definitely more than just one or two responses. Maybe use an array with a list of responses and randomly choose between those. ```python import random inputs = [ # inputs[0] ["hi", "hello", "hi there", "howdy", "hey",], # inputs[1] ["thanks", "thank you", "appreciated",] ] responses = [ # responses[0] ["Hi there! How can I help you today?", "Hello, how can I help?",], # responses[1] ["You’re welcome! Anything else you need help with?", "No problem! Need anything else?",] ] # fail response if input isn’t found fail_res = "I’m sorry, I didn’t understand what you said. Could you please rephrase that?" # Base example for getting inputs “hi” # “hello” etc and returning a random # response from responses[0] response = fail_res for inp in inputs[0]: if message.lower() == inp: # Get a random response from responses[0] response = random.choice(responses[0]) ```

Extrinix:

You will need to implement Flask and the post responses into that code snippet, but that’s just an example of available usage in your script.

hannahj:

looks fine 2 me.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!