Posts

Showing posts from May, 2025

GIS 5103 Lab 3 - DeBugging

Image
  For this week's lab we were asked to de-bug 3 separate instances of python scripts. For the first script we were asked to work through the code to debug it, the majority of the errors within this code chunk were simple punctuation and capitalization errors The second script was much the same, though errors were more complicated and included issues like an incorrect file path. For the third script, we were asked not to fix the code, but in fact to insert a Try-Except process to allow the code to run without fixing the error. For me, this entailed inserting the try function above code line 13 and then catching the exception after approximately 8 lines My full process for working through the creation of the Try-Except loop can be seen below Python 3.11.10 (main, Sep 20 2024, 18:44:55) [MSC v.1938 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license()" for more information. ========= RESTART: S:/GISProgramming/Module3/Result...

GIS 5103 Lab 2 - getting started in Python

Image
  For this week's exercise we were asked to  use a string to create a list from which the last name could be extracted, we were asked to debug some code to generate a dice game and we were asked to create a random list of twenty numbers between 0 and ten and then create an if else while loop that would allow for the counting of the instance of the numbers Assignment steps, Step 4: Create a loop that removes a chosen integer from the list previously generated This step involves creating a while loop and the remove() method to remove the chosen integer from the previously created list. Give a detailed explanation of how you completed this step. To start with, I created a variable, unlucky, and asked for user input: “Enter an unlucky number between 0 and 10 to remove from the list.” Then I created an if-else statement where if the chosen unlucky number was not in the luckyList, it would print “The unlucky number X is not in the list” Otherwise, it will print removing Y instance...

GIS 5103 Module 1

Image
For this week's lesson we were introduced to Python and the basics of creating flowcharts. As part of this we were asked to create a flowchart converting radians to degrees.   Additionally, we were taught how to find The Zen of Python, a short stanza on how to best write Python code. While some of the terms, such as Namespaces, are unfamiliar, the poem's overall theme is clear. The first several lines highlight the basics of writing any good code, that it should be simple, explicit, easy to understand, and well commented.  The inclusion of statements like Special cases aren’t special enough to break the rules, suggests that, unlike many other programming languages, Python isn’t case sensitive. The idea that there should be only one obvious way to write the code is definitely a highlight of Python compared to some other programming languages.