Wednesday, May 27, 2020

Python Fundamentals

This week our lab focused on the fundamentals of Python programming language. It was a great exercise to get familiar with the syntax, basic functions, and overall structure of entering a basic script. Our task was to create a dice game script. The first part of the script was given but I had to identify the two errors. I found this part to be easy because I entered the existing code in the ArcPro Python Window and it identified which lines had errors and what they were. Even at my beginners level, I could figure out what to change. The more challenging part of this assignment was creating one while loop that generated 20 random numbers between 0 and 10, and to choose an integer and count how many times it appeared in the list and then remove it. This assignment took plenty of trial and error. Below I have shared a screenshot of the results of my script and a flowchart of how I got
there.






Tuesday, May 19, 2020

Introducing Python


          I completed the exercise to gain some familiarity with Spyder and opening it via the Python Command Prompt from the Start Window. The script was already written and saved in my S drive so this assignment was definitely a basic introduction to executing my first script, so all I had to do was open the file. I inspected the general layout of the “CreateModFolders.py” script to hopefully learn the basic structure of a script. To be honest, this is very foreign to me, but I did notate that all scripts begin with a comments section that explains the code that it precedes. Once I studied it for a bit, I clicked “Run” and executed my first script successfully. Below shows a screenshot of all of the module folders for this course that were created with the scrip.