len: This function counts the length of a string
* : This is the multiplication function
And I used the Method, Split: This splits apart a string as in, lastNameList.split(" "). Where, lastNameList is the Object; split is the Method and (" ") is the argument.
Here is a brief description of what I did for this lab:
1. In order to calculate the length of my last name, I had to define my last name:
o listName=stringName.split and then, print listName[-1] (this will print the last name).
2. Then, I had to determine which function I should use to count the length of my last name.
3. I researched the available functions online and found “len.”
o len(object) -> integer
Return the number of items of a sequence or mapping.
4. I followed the syntax of: function(object).
5. My code for this process was: len(lastNameLen)
No comments:
Post a Comment