Programming Week 2: Python Fundamentals
In this week's module, we practiced writing and editing a simple Python script in four steps. In Step 1 we wrote our full name as a string, then split each name into separate items in a list, then selected our last name using an index. In Step 2, we had to find and correct errors in code for a dice game in which each player rolls dice with a total value that is twice the number of letters in their name, and they win if their roll is greater than half the possible total. In Step 3, we wrote a while loop with an if statement and break statement that created a list of 20 random numbers between 0 and 10. I was not sure what a counter variable was, so I had to look that up. I was able to write the code for Step 3 easily as just a while loop, but once I added an if statement and a break statement, I got stuck in an infinite loop and had to terminate ArcGIS Pro. I think it was because I originally included print statements in my while loop, although I don’t understand why that would crea...