Python: A Gentle Introduction Workshop Reflection

 

Python Programming Language | Learn Python With Examples | Edureka

 

When I first entered the Digital Humanities field I knew I wanted to gain more knowledge and experience within the realm of programming and coding. Skills attained in this discipline will not only help me with future projects but will also open the door for more opportunities in tech.

However with no prior experience in the mechanics of computing I knew early on this would be quite the arduous task for me to take on. I mean lets face it, data programming is not something you can learn overnight with a few YouTube tutorials and google searches. I do wish that were the case but seeing as though it’s not it was obvious to me early on that I had to take things slow to really ease myself into this meticulous field.

This is where Python: A Gentle Introduction comes to play. Hosted by Fordham University Science and Technology librarian, Katie Wolf, this workshop walked students through the general use programming language known as Python. Wolf began the workshop by giving us a basic run through of the general functions and usability of the app. Below I have listed a few in case anyone is curious and/or interested in using it.

-Interpreted language (Does what user tells it to do)

-“Object oriented”- Almost anything put into Python is considered an object

-Can visualize data

-Can be used to edit and create files

-Can interact with web (scrape website, parse html etc.)

Afterwards she brought up her version of Python as well as a text editor to give us live demonstrations of different ways a user can code on the app. Prior to the workshop we were all told to download Python on to our computers/laptops so that we may follow along using her examples. The version I installed was 3.10.02 (64 bit) for Windows (different version for Mac OS users).  As far as my text editor is concerned I did not have any of the ones Katie recommended on hand but she reassured me that was fine as long as I had a program I could write on. I ended up just using my notepad app.

Text editor Recommendations– SublimeText (TE), Atom (TE) or Atom-IDE (IDE), IDLE (IDE) for Windows, Visual Studio Code (IDE)

Once we had both open we opened up a command line interface where we were able to run our python scripts. In my case I had to use Powershell which was already available to me as a Windows user (Mac OS users use Terminal). Now that we had all the appropriate applications opened Katie was able to walk us through a variety of basic operations we can perform using Python. We started off first with variables. Variables can store information and be assigned any data type, however the user has to input the variable correctly in order for Python to understand. The variable must start with a letter or underscore (NO NUMBERS) and can’t contain any special characters or spaces. For example if a user wanted to type in the word “hello” it would have to be typed in as A= “Hello” or A_variable= “Hello”.

Once we finished with variables we moved on to basic data types such as strings, integers, floats, operators, lists and dictionaries. At this point the workshop turned more into a viewing than a follow along for me as Katie had premade strings made from previous coding attempts. I made the decision to watch rather than perform because my first attempt at coding while listening turned out to be a fail (I kept missing information and got hit with multiple unknown and syntax errors).  Here are some notes I took during the demonstration if anyone is interested:

Strings are always surrounded by quotes, loop able and countable, ex – a=”hello, world!” print (a.split (“,”)) – > [“hello”, “world”]  integers are whole numbers both positive and negative, floats are positive or negative numbers with decimals

Operators are used to perform operations on variables or values Arithmetic ex (+,-,=,*, /,%, etc.) Assignments ex (=, += ,-=, *=, /=, %=, etc.) Comparisons ex (==, !=, >, <, >+, <=) Logical, Identity and Membership (and, or, not, is, is not, in, not in)

Lists can store multiple items in a single variable with the use of square brackets [ ] and are indexed at zero. You can use method append () to add things to a list remove() to remove things from a list clear () to empty list completely, sort () to organize a list alphabetically and numerically etc.  Tuples have the same function but use round brackets/parenthesis ( ) Example:

Dictionaries are able to store multiple items in key: value pairs and use curly brackets { }. They can be ordered and changeable but don’t allow duplicates. Dictionaries can only be ordered in Python 3.7 and newer versions. Use keys() to see all keys, values() to see all values items () to get all key: value pairs and update() to change the value of the key: value pair. Example:

These are only a few of the items you can perform on Python. Hopefully my notes are clear but I can understand if this may look foreign to someone who has never coded before. That was certainly my reaction over the course of the workshop. There were several moments throughout the session where I found myself getting lost and falling behind. But that’s ok! Like I said coding is not something you learn overnight, it’s a skill you keep working on until you get comfortable-something even Katie made sure to mention during the demonstration.

With that being said my first baby step into programming has definitely been an impactful one.  Overall this workshop was highly informative and helpful. I left having a basic understanding of what Python is able to do and how I’m able to make it perform as a Windows user! I want to also give major props to Katie who not only answered questions along the way but also took the time out to stay behind on the zoom call in case anyone needed further assistance or explanation.

Here’s the simple code I created with Katie’s help: