For the second lab of GIS Programming, we got into Python fundamentals where we ran Python script using Notebook in ArcGIS Pro. This lab had us working with string variables, lists, if-else statements, creating loops and conditional statements including for/while loops.
Above are the results of the scripts that compile all four steps of the lab. For the first script, I printed my last name from a list of my full name. Then, I took a pre-written script for a dice game that contained errors that we had to identify and fix. One error was a simple case-sensitive error where a variable was capitalized when initially it was identified as lower case at the top of the script. The second error was more difficult to fix where I used string formatting to replace parentheses with braces for one of the print functions. For the third step, I generated a random list of 20 numbers from 1 - 10. For the fourth step, I named an unlucky number from the list and used a if-else statement to pick out if the list contained this unlucky number. Then, I used a for/while loop to remove every unlucky number in the list. The final line is the list with the unlucky number removed.This is the flowchart for steps 3-4.
This lab came with a huge learning curve for me and I am looking forward to getting more comfortable with Python language!

Comments
Post a Comment