Write a function to uppercase every other word in a passed sentence. So given “The dog ran a long way,” it would output “The DOG ran A long WAY.”
What will be an ideal response?
```
def upperCaseOthers(source):
parts = source.split(" ")
index = 0
newString = ""
for p in parts:
if index%2==1:
p = p.upper()
index = index+1
newString =newString+ p+" "
lastIndex = len(newString)-1-1
return newString[0:lastIndex]
```
You might also like to view...
Case-Based Critical Thinking Questions ? Case 1-1 Lucy wants to develop a web page to display her profile. She wants to just start with a basic page that lists her accomplishments, her work history, and the different computer courses she has taken. She would like each section to be clearly identified. ? What would be the best file name for Lucy's page according to Internet conventions?
A. ?Lucy's Info B. ?lucysinfo C. ?LucysInfo D. ?Lucys Info
It is a good idea to add ____ to code to explain what you have done to other designers.
A. tags B. indices C. logistics D. comments