Question: Write a function called cap 2 ( ) that takes a word and 'fixes' it so that only the first and last - tolast letters

Write a function called cap2() that takes a word and 'fixes' it so that only the first and last-tolast letters are capitalized. This function takes a string, and returns a string. Signature: def cap2(word): # your code here return Assumptions: Don't make any changes for empty strings; or strings with one letter. Examples: cap2('weekend')-> 'WeekeNd' cap2('Coffee')-> 'CoffEe' cap2('GradeScope')-> 'GradescoPe'

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!