Lesson 26 of 34

String Methods: split, join, replace

9 min 30 XP

split() वाक्य को शब्दों की list में बदलता है। join() list को फिर से एक string बना देता है।

Example: edit me and press Run

Output Loading Python (first time takes a few seconds)
Press Run to see the result here.

strip() दोनों सिरों के spaces हटाता है, replace() टेक्स्ट बदलता है, find() स्थान बताता है (न मिले तो -1) और count() गिनता है कि कितनी बार आया।

Example: edit me and press Run

Output Loading Python (first time takes a few seconds)
Press Run to see the result here.

isdigit() और isalpha() बताते हैं कि string किससे बनी है। [::-1] string को उल्टा कर देता है।

Example: edit me and press Run

Output Loading Python (first time takes a few seconds)
Press Run to see the result here.

Challenge

+30 XP

input() से एक वाक्य पढ़ें। हर शब्द का पहला अक्षर बड़ा करें और शब्दों को उल्टे क्रम में print करें। उदाहरण: "i love python" → "Python Love I"

Output Loading Python (first time takes a few seconds)
Press Run to see the result here.