Starting off module two we are
introduced to functions and modules. Functions offer more flexibility
than scripts, which allow the user to perform a task multiple times
with different values each time if necessary. On the other hand, a
module allows for easier organization of Python code. If someone is
writing a rather large program and they want to split it up into
several files, then modules are the answer.
For our assignment this week, we were
tasked in creating a program with the output as shown in the
screenshot provided. The program takes my full name, selects my last
name, and prints it to the screen, With the assignment of several
variables, the length function can then be used to determine the
number of characters. With that variable assigned, it is then
multiplied by three.
This was a great exercise in Python
considering that it did take some thought in writing the program and
therefore provide some practice in critical thinking. It would be
easy to just write the program around my name but allowing for any
name to be placed within it and run correctly presented a challenge.
Although this exercise only skimmed the foundation, it still offered
a substantial introduction.
Comments
Post a Comment