Introduction: Python Programming - Len Function

About: Occupation: tech support

Short Python program that used the "len" function to determine the number of characters in a string and print out specific characters in the word entered, ie: first, last, etc. Code is attached and below.

===========================================
WordEntered = input("Enter word: ")
print("The word entered was: ", WordEntered)
# Use the "len" command
LengthOfWord = len(WordEntered)

print("The the number of characters of the word entered is: ", LengthOfWord)

# To get the last character, subtract one from the length. Letters are counted starting at "0"
print("The last character of the word entered is:", WordEntered[LengthOfWord-1])

print("The first character of the word entered is:", WordEntered[0])

print("The 2nd to last character of the word entered is", WordEntered[LengthOfWord-2])

print("The 2nd character of the word entered is:", WordEntered[1])

print("The 3rd to last character of the word entered is: ", WordEntered[LengthOfWord-3])