You are browsing as a guest. Sign up (or log in) to start making projects!

1h 31m 27s logged

Welcome, reader. My name is Lucky, and this is my first personal project; and it's made using python. 

The modules I decided to use for now was just one: re. For context: my overall project is a cmd-line project that revolves around taking input from the user, a molecule, and predicting the molecular and electron-pair geometries of it. In other words, predicting the overall shape of the molecule. My first step is to count the valence electrons of the full molecule, and my first step in that is shown here. I was inspired by a bit of chemistry and I thought it would be an interesting first project to build my skills, although the concept is admittedly of low practicality or use. Little did I know, the overall idea requires a lot of parsing and error checking than I initially thought!
At first, I used for-loop logic to find subscripts and trace them back to their respective elements. The logic was personally overwhelming: while programming, the ideas were too much to hold: I had to think about this list and that list, this dictionary and that dictionary, this index and that index, lining up everything perfectly. I'm glad I pseudo-coded a bit as of before, as I'm afraid my head would have exploded. Even after building the for-logic, there was still too much to parse. It all felt arbitrarily too much for a relatively simple function. I had to take into account of the implicit subscripts of 1, the implicit coefficient as well . . . 

However, after the struggle, I realized that I could use re.findall to do such as the aforementioned. Plug in a simple pattern, and boom– no more parsing needed, no more messiness. Nonetheless, I am glad and I went through the struggle, as I learned a lot specifically, and I also learned about the reality of programming: it seems easier in your head– it’s certainly easier said than done. As Lao Tzu had said: “A journey of a thousand miles begins with a single step.” Although, admittedly, and ironically, I can’t say my journey is of a thousand miles haha. As you can see, I included I screenshot / small demo below, of what the project’s function is.
Next up, I plan to use the information granted by my code to count the number of valence electrons in the full molecule, possibly creating and using a dictionary of valence electron information for constituent atoms.
Reader, thanks for coming along and listening to my experience coding my first personal project! I am determined to keep going and ultimately reach my final goal. Again, my name is Lucky, and I thank you for reading.

0
1

Comments 0

No comments yet. Be the first!