Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- text = "How are you?"
- print(text[0])
- print(text[1])
- print(text[2])
- print(text[11])
- print(text[-1])
- print(text[-2])
- H
- o
- w
- ?
- ?
- u
- for i in range(0,len(text)):
- print(i, text[i])
- 0 H
- 1 o
- 2 w
- 3
- 4 a
- 5 r
- 6 e
- 7
- 8 y
- 9 o
- 10 u
- 11 ?
- new_string = text[::-2]
- print(new_string)
- ?o r o
- # len()
- # upper()
- # lower()
- # title()
- # count()
- # find()
- # replace()
- # strip()
- # lstrip()
- # rstrip()
- text = "How are you?"
- print(len(text))
- print(text.upper())
- print(text.lower())
- print(text.title())
- 12
- HOW ARE YOU?
- how are you?
- How Are You?
- text = " Nayeem "
- star = "*********"
- print(star+text.lstrip()+star)
- print(star+text.rstrip()+star)
- print(star+text.strip()+star)
- text = " Hello World "
- print(star+text.strip()+star)
- new_string = text.replace(" ","")
- print(new_string)
- *********Nayeem *********
- ********* Nayeem*********
- *********Nayeem*********
- *********Hello World*********
- HelloWorld
- # count("word/letter",start, end)
- text = "where there is a problem there is a solution"
- print(text.count("is",16,20))
- 0
- # replace("<pass string>","<pass string>",<pass integer>)
- text = "where there is a problem there is a solution"
- print(text.find("is",13))
- text = text.replace("is","are",20)
- print(text)
- 31
- where there are a problem there are a solution
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement