Processing Strings | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 2

Processing Strings

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

6th Mar 2017, 6:06 PM
Jeremie
Jeremie - avatar
5 ответов
+ 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...
7th Mar 2017, 4:40 AM
visph
visph - avatar
+ 5
upper() lower() [::-1]
6th Mar 2017, 6:09 PM
Álvaro
+ 2
upper and lover are methods and no functions. so you should print text.upper() and not upper(text)
6th Mar 2017, 7:23 PM
Hbeo
Hbeo - avatar
+ 1
@Alvaro I get how you use the first two, but how do you do the last one?
6th Mar 2017, 8:50 PM
Jeremie
Jeremie - avatar
0
yous should do list=list[::-1]
7th Mar 2017, 2:38 PM
Hbeo
Hbeo - avatar