replace(), title(), lower(), upper() на каждый метод
составить по 10 примеров
Ответы
Ответ:
Метод replace():
"Hello World".replace("o", "*") --> "Hell* W*rld"
"bananas".replace("a", "o", 1) --> "bonanas"
"apple".replace("p", "") --> "ale"
"12345".replace("5", "") --> "1234"
"Hello, World!".replace(",", "") --> "Hello World!"
"AAABBB".replace("A", "X").replace("B", "Y") --> "XXXYYY"
"foobar".replace("o", "", 1) --> "fobar"
"1 2 3 4 5".replace(" ", "") --> "12345"
"Mississippi".replace("s", "$", 2) --> "Mi$$i$$ippi"
"hello world".replace("world", "python") --> "hello python"
Метод title():
"the quick brown fox".title() --> "The Quick Brown Fox"
"i am groot".title() --> "I Am Groot"
"1234 abc".title() --> "1234 Abc"
"hello_world".title().replace("_", " ") --> "Hello World"
" cAt cHiCKen cow ".title().strip() --> "Cat Chicken Cow"
" 1st 2nd 3rd ".title().strip() --> "1St 2Nd 3Rd"
"~apples pears oranges~".title().replace("~", "") --> "Apples Pears Oranges"
"I'm a lumberjack and I'm okay".title() --> "I'M A Lumberjack And I'M Okay"
"life is like a box of chocolates".title() --> "Life Is Like A Box Of Chocolates"
"hello, world!".title().replace(",", "") --> "Hello World!"
Метод lower():
"Hello World".lower() --> "hello world"
"BANANAS".lower() --> "bananas"
"1, 2, 3, Go!".lower() --> "1, 2, 3, go!"
"AbCdEfG".lower()" --> "abcdefg"
"ROCKnROLL".lower()" --> "rocknroll"
"ShE SeLls SeAsHeLls By ThE SeAsHoRe".lower()" --> "she sells seashells by the seashore"
" SPACE SPACE SPACE ".lower()" --> " space space space "
"1234".lower() --> "1234"
"THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG".lower() --> "the quick brown fox jumps over the lazy dog"
"Lorem Ipsum Dolor Sit Amet".lower() --> "lorem ipsum dolor sit amet"
"Hello World".upper() --> "HELLO WORLD"
"bananas".upper() --> "BANANAS"
"1, 2, 3, Go!".upper() --> "1, 2, 3, GO!"
"AbCdEfG".upper() --> "ABCDEFG"
"rocknroll".upper() --> "ROCKNROLL"
"ShE SeLls SeAsHeLls By ThE SeAsHoRe".upper() --> "SHE SELLS SEASHELLS BY THE SEASHORE"
"python is fun".upper() --> "PYTHON IS FUN"
"the quick brown fox".upper() --> "THE QUICK BROWN FOX"
"Lorem Ipsum Dolor Sit Amet".upper() --> "LOREM IPSUM DOLOR SIT AMET"
"12345".upper() --> "12345"
Объяснение: