Ask coding questions

← Back to all posts
I'm a beginner to python and i'm really struggling to make a chatbot, what should I do?
Tezz (0)

I'm trying to make a basic chat bot that remembers previous conversations how can a beginner do this with python?

Voters
Tezz (0)
Comments
hotnewtop
multicoder2021 (3)

Yes, like @DynamicSquid and @Tezz, you should learn previous steps...

  • Learn about input...[Link down below]
  • If, else, elif, for and while statements
  • Arrays
  • Text file handling [link down below]
    And if you really want this to be a serious project...
  • Databases with SQL [link down below]
    Also, if you want to make this public and turn it into HTML, JS and CSS...
  • PHP [link down...below...]
    So yes, you will have to learn all these.

Links:

Input

https://replit.com/talk/ask/How-to-add-a-input-in-python/41157

Text file handling

https://docs.replit.com/tutorials/02-managing-files-using-repl-it

Databases with SQL

https://www.w3schools.com/sql/

PHP

https://www.w3schools.com/php/DEFAULT.asp

I think you should save this project for later, when you are more experienced than a begginer, because SQL and PHP is sorta hard.

DynamicSquid (4916)
  1. get user input
  2. learn about if statements to respond to user input accordingly
  3. learn about arrays to store previous user input
Roar123 (443)

@Tezz You should probably practice this before moving to text files

Roar123 (443)

Since you are a beginner, I would recommend writing to a text file. Note this will only save local chats, someone else using your program can't permanently write to your text file, only you can. If you want to make a fully functional chat bot in Python, send a request to a flask server and write that onto a text file there. That would process and save everyone's chats. For now, just start off with working with text files.

DynamicSquid (4916)

@Roar123 Aren't writing to text files a little too much for a beginner?

Roar123 (443)

@DynamicSquid Not really, just open, write or read, and then close. The benefit is that they can store info after the program has ended.

DynamicSquid (4916)

@Roar123 Oh true. I guess I was thinking more of a learning path where text files are generally the more advanced topics