Thursday, May 28, 2015

Module 2 - Python Fundamentals

This week in Programming we wrote our first Python script. It's a short script but without going through the 23 page practice exercise before trying to write it, I would have been completely lost. I learned a lot about syntax, assigning variables, and had a brief introduction to methods and functions. I know once we delve deeper into scripting for GIS I'm going to get a little confused with the names and uses of all of the tools and functions available. That being said, I am really glad that the Python Window in ArcGIS provides prompts when you start typing in the code and at the same time provides a help window with directions for how to fill in the required objects and arguments. I think those features will be lifesavers for me as this course continues on.

The script I wrote identifies my last name, counts the letters in my last name, and multiplies that number by three. The initial variable I started with was my full name and then I used functions and methods to create new variables and count the letters. The picture below shows the result of running the script.
Result of Last Name Script
One thing I learned this week that I am going to have to be extra careful about is using the right characters. Brackets, parentheses, apostrophes, and quotation marks all have specific purposes and are not always interchangeable.

No comments:

Post a Comment