Processing Strings | Sololearn: Learn to code for FREE!

+2

Processing Strings

How do you capitalize/lowercase text, and reverse the order of letters?

3/6/2017 6:06:04 PM

Jeremie

5 Answers

New Answer

+11

The last one is slice notation: list[i] access to item at index i list[start:stop] return a range copy from index start ( included ) to stop ( not included ) list[start:stop:step] return a range, using a step. Not specifying a value set it as default 0 ( first item ) for start, and last item/index included ( last index+1 ) for stop. Negative step would produce a reversed copy...

+5

upper() lower() [::-1]

+2

upper and lover are methods and no functions. so you should print text.upper() and not upper(text)

+1

@Alvaro I get how you use the first two, but how do you do the last one?

0

yous should do list=list[::-1]