A Noob's Adventures in Coding: Chat Bot
I'm new to Python, so this took over an hour of trial and error to get right, and since my knowledge of technical Russian is extremely lacking, I'm not going to write in my usual bilingual format. Anyway, I thought I might share this little adventure. The first step was to program a computer to process inputs. This is a simple function:
Note that these are lines 4 and 5. That's because this simple operation is part of a larger program that I wrote around the input exercise. This is the beginnings of a chat bot:
This is a very simple Python program, I think we can all agree. However, when I decided to write a Russian version (I am making literal Russian bots!), the program more than doubled in size from 19 lines to 55 and contains not one, but two nested while loops! The reason has to do with a quirk of Russian grammar. If you can't figure it out from looking at the code, let me know, and I'll happily explain.
Actually, I need to explain anyway, because in order to write a while loop that did what I wanted (reporting the value of the ones place in any given integer), I experimented with a separate program to see if I could get the computer to do what I want, and then copy and paste the relevant code blocks into the chat program. This is what I came up with:
The extra "print" commands are in there to show me that the program is performing the correct calculations. This is the output, from an input of 59:
Once I have that value, I can assign a grammar variable to it, which will alter the chat bot's output accordingly. I'm sure there's a more efficient way to do this, but I haven't gotten to that point yet. As of this post, I have been playing around with Python for exactly one week, so I don't really know what I'm doing. Granted, this isn't my first programming language (that would be industrial g-code), so I'm not completely new to coding.
Oh, I guess I should show you Kaja-bot's output!
Anyway, I had fun. What do you think? Am I right to find this mildly humourous, or am I just needlessly giddy from staring at a screen for too long?
Leave A Noob's Adventures in Coding: Chat Bot to:
Read more #coding posts
Best Posts From Kaja Blackwing
We have not curated any of steampunkkaja's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.
More Posts From Kaja Blackwing
- TROPICAL EXHIBITION: HUGE SPIDERS AND OTHER NICE CREATURES
- Quinquereme in OnShape
- Gettysburg Militaria (47 Photos)
- Редкая Сладость и Гадость / A Rare Trick and a Treat
- Custom Hinge Pintles / Штыри для Петель, Сделаны на Заказ
- У Ковка Героев Проблема с Масштабом / Hero Forge has a Problem with Scale
- Прогулка в Среду Через Дымку / Wednesday's Walk Through Haze
- Early Bird / Раняя Пташка
- 3D-PRINTING AT HOME✨
- Цыплята 2023 года - Выводок № 2 / Chicks of 2023 - Brood № 2
- Гнезда Голубей / Doves' Nests
- Ковка Героев Миниатюры: Чара и Санс / Hero Forge Miniatures: Chara and Sans
- Цыплята 2023 года - Выводок № 1 / Chicks of 2023 - Brood № 1
- A Confusion of Guineas / Путаница Цесарок
- A Noob's Adventures in Coding: A Game You Cannot Lose
- Ковка Героев Миниатюры: Вульпрагон / Hero Forge Miniatures: Vulpragon
- A Noob's Adventures in Coding: Chat Bot
- The Next Five Months
- Ковка Героев Миниатюры: Привлекательные Лесные Души / Hero Forge Miniatures: Sexy Forest Spirits
- Противоядие от Пропаганды / An Antidote to Propaganda