For the summer semester of 2022 I have enrolled in GIS 4102 to better understand the ins and outs of programming in GIS. We began interacting with python code in the IDE spyder. This software allows us to visualize and edit the code directly. Our first task was to run a provided script that creates all of the folders that we will be using throughout the semester directly into the designated S drive. After establishing the folders the assignment could begin. Opening the module template revealed some provided code. The first step of the assignment involved creating a string that involved our full name and then splitting that string into individual names. Using indexing I used a print function to display only my last name. The next step of the assignment was to correct two errors present in the provided dice game code. This was where I ran into my first hurdle. The first error was simple, correct the case of the x variable, the second error was tricky. I finally figured out that string values can only be added to other string values and not integers + strings which was the situation I had going on.The next steps involved creating a random generated list of twenty integers, 0-10, that when generated detects for an unlucky number. If this unlucky number is detected the number is removed and a print statement indicates how many times the unlucky number was removed. If the unlucky number is not detected a print statement indicates that the unlucky number was not in the list. These steps of the module took the longest. I ran into another issue involving correct parentheses usage that was solved after thorough contemplation and help from the UWF GIS youtube channel. Going forward this module has equipped me with the basic knowledge to read, understand, and interact with python coding. Paying close attention to syntax is key to achieving success in programming.
Here is a screenshot of the full script ran from the sypder console.
No comments:
Post a Comment