Mod 1 Python Fundamentals Lab "Dice Game"
This week we were introduced to the basic fundamentals of Python focusing on its use in GIS. We learned how to access the Python Window in ArcGIS Pro and how to access the Python Command Prompt to utilize Spyder for our programming. We used Spyder for all of our Python script writing int this assignment.
For this lab we first made a script that would print our last name from a list. Next, we were asked to find the errors in a pre-written section of code for a dice game and correct them. Our next objective was to create a loop that adds 20 random number between zero and ten to a list. For our last step we were tasked with creating a loop that removes a chosen integer from the previously generated list.
It all sounds so simple right? It was definitely a challenge and gave me a greater appreciation for the programming that goes on behind many of the preloaded scripts in ArcGIS Pro.
After making what seemed like hundreds of errors I was finally able to get these results:
As you can see it printed my last name. It also shows what each plyer rolled and if it was a win, loss or tie. The created list of 20 random numbers between 1 and 10 was also printed and lastly we have out list of numbers with the unlucky number 8 removed.
Flowcharting is also used in Python to basically map your script out. I made one for each of the steps in this lab on PowerPoint.