The Fundamentals of Python

We slithered right into Python this week by creating our own code (or "script") that incorporated many of the basic elements of coding. Through the use of lists, methods, and loops, we created a script that printed out the following:


The first line is the output of selectively picking an element from an index (a numbered list), which in this case was our full name. We had Python select only the last element in the list and print the output. Next, we had to inspect a given piece of code and had to identify and correct the errors to produce a dice game. 

Lastly, we were tasked with a multitask script. It had to first generate a randomly populated list of 20 integers between the numbers 0 and 10. Then it had to identify the number of times a selected integer was found within the list, print this information, and recreate the list without the chosen number. This was definitely the most challenging aspect of the module as it incorporated every skill learned this week. Structuring the code with if-else statements allowed the code to repeat a certain process until a pre-determined threshold was met.

My biggest takeaway this week has been that every element written must precise and written with forethought. The slightest mistype will result in an error and the computer will never assume your intention. However, seeing that first line of code return exactly what I wanted was so satisfying!

Comments

Popular posts from this blog

Coastal Flooding & Storm Surge Analysis

Welcome to GIS 5007 Spring 2023

Introduction to Python