GIS Programming Module 2 – Python Fundamentals
Module 2 assignment covered some of the fundamentals of Python. This included learning about the different Python data types, working with string variables, understanding loops and conditional statements, and iterating through variables. The screenshot below shows the output of the script written for the assignment. Step 1 was to create a variable to hold my full name separated by spaces, split the variable using the spaces, and then print my last name using the index -1. The index -1 is the last item in the list which was my last name. Step 2 was to fix two errors in the code that was provided. The code uses a list of the first names of players and calculates the number of characters in players’ name. Each player rolls a dice which is randomly selected from a list of integers from 0 to 2 times the number of characters in the name. Players win if the dice is greater than the number of characters, tie if they are equal, and lose if the dice is less than the number of ...