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?