GIS Programming - Mod 3
Woohoo! What a blast. So far programming in Python is like sitting around playing with a jigsaw puzzle and getting credit for it. This week's lesson was a bit more complicated. This week we started with a code that was partially written, with a few mistakes in it. We had to correct the mistakes for the code to create a dice game based on the players' name length.
Results of Python Script |
I didn't have any difficulties with the portion of the assignment we were required to take notes on; removing numbers from the list. My difficulties came from the previous section where we had to print statements saying how many, if any numbers were to be removed from the list.
It was a fairly
simple process until my first test came back with the result of removing only one instance of my unlucky number. That was when I realized I was gong to need an elif statement in there too, otherwise the sentence would read that it was taking the unlucky number out "1 times." and that wasn't right. Figuring the syntax out for that was pretty easy, but it took me quite a while to figure out how to express the elif statement in the flowchart. All the examples I had seen were basically just if/else statements so I had to play with it for a bit to figure out what made sense for the if/elif/else combination.
Flowchart of Python Script |
Another confusion I had with the flowchart was how to handle not starting at the beginning. It was left to us to decide if we would include the code that had been provided for us or just start where we created the code ourselves. I decided to start where I started, but I didn't want to leave the impression where I started was the beginning of the script so after showing we imported random I added a break to the flow line and hoped that would make sense.
While I learned a lot from this lesson I think one of the most important things I learned is that I need to reorganize my previous lessons so certain aspects of them are more easily accessed. If this week's lesson is any indication it looks like I'll need to go back quite a bit to refresh and clarify how to do certain things. There is so much to learn in each lesson it just isn't possible to absorb it all at once.
No comments:
Post a Comment