Professional Documents
Culture Documents
'Google': 'O' 'O' 'G' 'G'
'Google': 'O' 'O' 'G' 'G'
h='google'
In [2]:
len(h)
Out[2]:
In [3]:
h.count('o')
Out[3]:
In [4]:
h.count('o','g')
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-4-20f976a7a470> in <module>
----> 1 h.count('o','g')
In [5]:
h.count('go')
Out[5]:
In [6]:
h.find('g')
Out[6]:
0
In [7]:
h.find(":g")
Out[7]:
-1
In [8]:
k="Hai Hello"
In [9]:
k.swapcase()
Out[9]:
'hAI hELLO'
In [10]:
k.split()
Out[10]:
['Hai', 'Hello']
In [11]:
k.endswith("o")
Out[11]:
True
In [12]:
k.endswith("e")
Out[12]:
False
In [13]:
k.isupper()
Out[13]:
False
In [14]:
k.islower()
Out[14]:
False
In [15]:
k.replace("Hai","Bye")
Out[15]:
'Bye Hello'
In [16]:
m='?????hello'
In [17]:
m.strip("?")
Out[17]:
'hello'
In [18]:
m.isdigit()
Out[18]:
False
In [19]:
m.isalpha()
Out[19]:
False
In [20]:
l="hai"
l="hai"
In [21]:
l.isalpha()
Out[21]:
True
In [ ]: