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...
Determine whether each of the following is true or false. If false, explain why.
1) To refer to a particular location or element within an array, we specify the name of the array and the value of the particular element. 2) An array definition reserves space for an array. 3) To indicate that 100 locations should be reserved for integer array p, you write the declaration p[ 100 ]; 4) A for statement must be used to initialize the elements of a 15-element array to zero. 5) Nested for statements must be used to total the elements of a two-dimensional array.
Which title would probably not be used by a technician?
A) Mr. B) Ms. C) Professor D) Secretary
When you create a table, Excel automatically applies a default table style.
Answer the following statement true (T) or false (F)
Why should at least one custom group be created within WSUS?
What will be an ideal response?