Wikipedia

Search results

Monday, June 28, 2021

Introducing Python

Python is the primary language and the coding script used in GIS and specifically in the ArcGIS Pro 
program. To begin the course we first learned how to use some basic coding techniques. This involved running some basic scripts as displayed below.



The script above shows some basic coding we did to learn the foundation of using the python language. To start I learned how to print my name fully. Then in the second line I was able to learn the split() function so that I could take my full name and be able to full the contents apart. Then for the 3rd part I was able to specifically choose one word out of this. Specifically, my last name and only print that part. This is a usual feature if you have an abundance of text but, only want to pull out a few parts of the text for referencing.

The next part involved fixing a pre-existing script and being able to properly make the dice game work. While the code did indeed have a few errors in it this wasn't very hard to rectify. Once completed it was pretty interesting to see the game play out. It really put into perspective that even writing just a bit of code such as this could actually easily apply a randomized game like scenario. This excited me very much as someone who has always enjoyed flash games and things such as that. Although, this is a very basic form of something like that it still had basic gaming concepts to it. Everything time you run the code the chances are different for the exact rolling numbers and it will fluctuate between winning, losing and tying for each player.
This next code above this text was much harder for me to get to run. What it does is allows the script to run a projected 20 random numbers which will be between 0 and 10. I had to specifically write the code to do each of these tasks. Not only allowing it to only chose numbers between 0 and 10 randomly. But I had to make it to where it wouldn't exceed the count of 20.

The last bit of this project as shown above was indeed very difficult for me to get past. It combined the code above randomizing the numbers in the same format and only allowing 20 initial choices. But, in this part I had to choose a certain number (unlucky(10)) and remove that number however many times it appeared in the text. Not only that but it had to respond with how many times it removed said number or if it didn't appear then say that as well. I had to pour through many functions and combine a variety of techniques to achieve the desired result. But, after much deliberation as shown above the code ran and as shown removed 10 from this list 1 time. But the results were almost endlessly different for every time the code is ran.

The first week was a hard introduction into the course but, very gratifying as well. I believe it gave a solid footing into the GIS Programming world and a good foundation for future projects! 

 

No comments:

Post a Comment

GIS 6005: Lab 6

 This lab week consisted of working with choropleth mapping, but in a more unique way then what we've done thus far. We ended up compari...