How I Worked Smarter with Python: Beginner Friendly

Nov 21, 2022ยท

3 min read

How I Worked Smarter with Python:  Beginner Friendly

The Problem ๐Ÿ˜ฐ

I work as a Post-Sales Engineer, enabling customers to adopt our product and ensuring a smooth renewal process. In my role, I often deal with customer issues during renewal time like deciding which licenses are going to be renewed and which ones aren't. This may trivial, but when working with an enterprise customer that has over 200 licenses expiring, determining which licenses are applied can be a nightmare.

Traditionally, I would open that customer's salesforce records to review all licenses that are up for renewal. I would then cross-reference with our internal portal to see which ones are currently applied. When using our internal portal, I sometimes do not have the option to export the data as a CSV file, which I could filter, so I would find myself hand-jamming license ID numbers slowly. The process would look something like this...

"Okay, 005492 is being used. 005493 is being used. 005494 is being used" and so on until I reach a value that is not in use. I would slowly each value that is being used. You might be asking yourself "why not just copy and paste the values?"

One, it would still take a long time to go down this long list of numbers doing a "ctrl c & ctrl v" type operation.

Two, sometimes copying & pasting spits out values in an ugly format. I will need to present this data to our customer, so making the data look pretty is necessary. Spending time modifying the values so they look ~normal~ is not the best use of my time.

The Solution ๐Ÿ˜Ž

I recently have undertaken learning Python in preparation for my Computer Science program. I've gone over basic syntax, conditional statements, data structures and whatnot; the usual things you learn in an "Intro to Programming Class."

I was working through THE problem of a long list of sequential licenses and I had an epiphany. I know enough code to write a simple program to give me the values that I need. I got to work and quickly came up with three iterations of my program. Each version solved a limitation that the previous version had.

Version 1:

In version 1, I defined a variable that would be my starting point and I decided to loop through it. It was fairly simple and the output kinda gave me what I wanted. I still needed the 494 to be included and I didn't want the comma at the end of the 504.

I realized that if I created a list, I could still loop through numbers using "while," but get rid of that stubborn comma at the end.

Version 2:

Now, this is more like it!!! I was able to define a conditional statement that would include 494 as well. This gave me exactly what I needed, but I found another limitation. Where's the function?! Without this code being in a function, if I wanted to change x and the stopping point, I would have to hardcode it every time. By putting this code in a function, I could pass arguments for two different parameters specifying a range start and end point.

Version 3:

The final product. Simple. When using the range function, the stop point is exclusive, so if I wanted "y" to be included in my list, I had to use the parameter "y+1".

Concluding Thoughts

This is an early experience with using code to solve a simple task. It may not seem extraordinary, but I'm proud of myself nonetheless! I'm excited to continue to grow my Python skills and build other solutions or applications one day. I'm sure I'll look at this post years later and smile of the progress I've made ๐Ÿ™๐Ÿฝ