Pseudocode = reads a word and then prints the first character, the last character, and the character in the middle. Need help with my code.?

Update:

3

4

5 Main program solution- lettersinWord.py

6

7 def main():

8

9 """*******************

10 Local variables=

11 print(word = scott)

first_Character

last_Character

middle_Character

12 len(scott)

Input = str= scott

Process Formulas=

first_Character = str[0]=s

last_Character = str[5]=t

middle_Charcter = str[3]= o

25

28 Output print(first_Character + last_Character + middle_Character

1 Answer

Relevance
  • EddieJ
    Lv 7
    12 months ago
    Favourite answer

    S C O T T

    0 1 2 3 4

    The last character is str [4], but you can also use str [-1].

    lastindex = len (str) - 1

    middleindex = lastindex // 2

    Scott is a bad example because you could accidentally pick the wrong "t".

    • Commenter avatarLog in to reply to the answers
Still have questions? Get answers by asking now.