Thursday, September 25, 2014

KISS, KISS or Keep It Simple, S...

So, I was studying about strings in Python using How to Think Like A Computer Scientist. They're fairly easy. And yes, there's a lot you can do with string. (I'm still not sure if I really need to understand L-systems when it comes to coding. I did run into issues in following the code and predicting results with that. However, I'm not sure if I am not understanding L-systems or not understanding the code. I think it's the former and will investigate more later.)

Anyhow, at the end of the chapter, there is something about character classifications and the hint to try this out:

So, I put that into the workspace and get:


Ok, so, I need to define the string, right? I define a string and get:


Ummmmm... ok. Maybe the string should be named something else. After all, "string" is kind of a keyword in Python (yes, I know it's actually "str")... Let's rename it to "astring" and make sure to update everything in the print statements otherwise it will tell me that "astring" is undefined...


Hmmm, same error... What the heck is going on here?

Now, in the back of my head, this little thought keeps popping up, "Hey hey. Does your little code bit there actually tell ActiveWindow that it wants to access all the functions or classifications related to strings?"

After a few more tries varying the code, I finally decide to listen to that little thought and...

Result! Yay! Although the successful outcome made me want to:


And yes, I took way too much time drawing and animated this gif...

No comments:

Post a Comment