Tuesday, May 26, 2015

Module 2 - Python Fundamentals Part I

In this module, we're still getting our feet wet with Python programming. We learned about string variables, methods and functions used to manipulate strings and lists, and how to perform basic math functions with Python.

After working through the weekly exercise which got us familiar with strings, lists, functions, and methods in Python, we began the assignment, which was just to write our first Python code. In this lab, we create a string of our full name, and then split that string into a list (First, Middle, Last). We used indexing to print our last name from the list. Then we had to assign a couple of variables. The first variable uses the len function to find the length of our last name, and the second variable multiplies the length variable by 3. When run successfully, the code should display our last name and the value that is three times the length of our last name.


As you can see, my last name contains 8 letters, and 8 *3 = 24, so the code executed correctly. I enjoyed working with the basics of Python and am interested in learning more. As someone familiar with FORTRAN, I can already say I am enjoying Python a lot more.

No comments:

Post a Comment