GIS Programming Module 2: Python Fundamentals
Module 2 in GIS Programming was focused on the fundamentals of Python. For the reading we covered chapter 4 of Paul A. Zandbergen's Python Scripting for ArcGIS Pro. This chapter was incredibly long and dense. The sheer number of concepts that have to be memorized is vast and complicated.
Once the reading portion of module 2 was completed I started on the lab portion of the module. In the lab we created a script using the concepts from chapter 4 in the textbook. The script began by taking my full name as a text string. It then processes this string to separate the individual names into a list of words. From this list, the script specifically identifies and prints out the last name, showcasing basic string and list manipulation techniques.
The second part simulated a simple dice game involving a predefined set of players. For each player, the script calculated a unique target score based on the length of their name. It then generated a random "dice roll" for them. The script then determined if each player's roll leads to a win, a tie, or a loss, and printed the outcome for each player.
Following the game, the script proceeded to create a list of random numbers. It used a loop to repeatedly generate 20 random whole numbers, with each number falling between 0 and 10. These randomly generated numbers were collected and stored in a new list, which was then displayed.
The final section of the script focused on modifying the list of random numbers created in the previous step. It selected a specific "unlucky" number. The script then checked if this chosen number exists in the list and, if so, identifies how many times it appears. Finally, it employed a loop to systematically remove all occurrences of this "unlucky" number from the list, presenting the cleaned, updated list as the final output.
This lab was challenging largely in part due to the fact that it is the first time I have ever scripted anything. I also spent about 10 hours total re-reading parts of the textbook, watching YouTube videos and researching the concepts from chapter 4. While it was very challenging, I look forward to moving on to the next lab and using what I have learned there as well.
Comments
Post a Comment