Question: Exercise 19 Write a function capitalize_last(phrase) that takes in a string phrase consisting of arbitrarily capitalized words separated by spaces, and returns a new string

Exercise 19
Write a function capitalize_last(phrase) that takes in a string phrase consisting of arbitrarily capitalized words separated by spaces, and returns a new string consisting of those words but with the only the last letter in each word uppercase.
You can assume that the string contains only letters and spaces, no punctuation.
Examples:
>>> capitalize_last('tEst WiTH rANdoM capITaliZATioN')
'tesT witH randoM capitalizatioN'
>>> capitalize_last('')
''
>>> capitalize_last('i am the senate')
'I aM thE senatE'

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 Databases Questions!