Lesson 26 of 34

String Methods: split, join, replaceString Methods: split, join, replace

9 min 30 XP

split() ஒரு வாக்கியத்தை வார்த்தைகளின் list ஆக்கும். join() ஒரு list-ஐ மீண்டும் ஒரே string ஆக்கும்.

split() turns a sentence into a list of words. join() turns a list back into one string.

Example: edit me and press Run

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

strip() இரு பக்க space-களை நீக்கும். replace() ஒரு பகுதியை மாற்றும். find() இடத்தைத் தரும் (இல்லையென்றால் -1). count() எத்தனை முறை என்று எண்ணும்.

strip() removes spaces at both ends, replace() swaps text, find() gives the position (-1 if missing) and count() counts occurrences.

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-ஐ தலைகீழாக்கும்.

isdigit() and isalpha() tell you what a string is made of. [::-1] reverses a 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"

Read a sentence with input(). Capitalise the first letter of each word and print the words in reverse order. Example: "i love python" → "Python Love I"

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