Intro to GIS Programming

 This week the GIS programming course began. The objective for this week was to learn the fundamentals of Python coding. We were tasked with creating codes that include strings, lists, and while and for loops. The results of my code are below. It includes steps 1 through 4. Also included below, my workflows demonstrate my codes and process.



Workflows:
I have included my workflows for steps 1 through 4. Creating step 1 was easy because it utilized strings, lists, and the split function. In step 2, we were told to fix two errors. One of which was a lack of quotation marks around the print (p + "rolls a" + "dice" + "out of" str(x*2)). In step 3 we were instructed to create a while loop that created 20 random numbers that ranged from 0 to 10. I used the random integer function to create the random numbers, x was the counter variable, and my if and break statement stopped at 20. Looking at step 4 in more detail, I created a code that removed an unlucky variable by first establishing my unlucky variable and my if-else statement. I chose this because it was simple but told the script to run as long as the unlucky variable is found in the luckyList. My next line said “luckyList.remove(unlucky)”. LuckyList is present because the remove function needed a source. The remove function was instructed to remove the unlucky variable, which was named earlier.






 

Comments

Popular posts from this blog

GIS Programming- Exploring and Manipulating Data

Spatial Data Quality Standards

A little bit about me..